[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
How did you guys start to learn programming? I'm trying
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 90
Thread images: 4
File: C.png (14 KB, 600x600) Image search: [Google]
C.png
14 KB, 600x600
How did you guys start to learn programming? I'm trying to learn C and I'm not sure if I'm just retarded or what. It always takes me a couple minutes to fully understand how the program works.

Whenever I do the exercises I literally can't understand what they want me to do or how. After trying to understand it I give up and look it up, afterwards I'm in awe at how fucking simple it was and how I couldn't create it.
>>
start simple and go from there.
for x = 1 to 10
print "OP is a fag"
next

can you guess what this does?
>>
>>53928343
Compilation error
>>
.h
this is where you put vars that will be used in more then one scope.
.cpp
every thing else
>>
there's a reason universities don't teach C in intro to programming
>>
>>53928366
If you had put it in a main() {} function and used the right syntax for the for loop it would have printed "OP is a fag" 10 times
>>
>>53928439
What should I start with than? Treat me like a retarded 5 year old, because that's what I feel like
>>
.h
this is where you put vars that will be used in more then one scope.
.cpp
every thing else

then theirs the pointers

var *varNamePointer; or
var* varNamePointer either one

&varName memory address

sets the pointer to varName address
varNamePointer = &varName;

getting methods from pointers
varNamePointer->toString();

getting methods from objects
varName.toString();
>>
>>53928470
Java. Download Eclipse this instant.
>>
>>53928483
fucking reeeeeeeeeeeeeeeeeeeee
>>53928470
go with c its fucking easy as 3.14
>>
>>53928493
Java is easier.
>>
>>53928514
java is shit
>>
>>53928526
Java is not shit.
>>
>>53928493
>easy
>preprocessor with completely different grammar
>weak type system
>terrible string functions
>undefined behavior everywhere
>>
Just start with python
>>
>>53928003
RPG
>>
File: 8-tips-moms-learning-to-code.jpg (563 KB, 1500x1000) Image search: [Google]
8-tips-moms-learning-to-code.jpg
563 KB, 1500x1000
>>53928003
>where do I start
code.org/learn
or
pic related
>>
>>53928535
using a vm based programming language
>>53928553
complaining that you have to define memory and not have it assumed for you
>>
>>53928439
mine does. Along with c++ for OOP.
I do live in a third world country though.
>>
>>53928601
that's because feminists stay the hell away from third world contraries and your education isn't shit
>>
>>53928610
don't know about education not being shit, but the amount of women is practically null and none of them knew anything about programming and were complaining all the time because they actually had to take the class.
To be fair, most men didn't know anything either and ended up failing.
>>
>>53928670
I was talking about how collages and university have to meat a "diversity quota" making the average person even dumber because instead of letting people who want to go to learn in they have to let the retarded web devs in and then they bitch about how hard it is and the school has to lower its expectations even more
>>
>>53928591
Nice meme bro

That website is also gay as shit, does it have a tutorial where I don't have to dance in a pretty circle with Elsa and Anne?
>>
>>53928670
https://twitter.com/GirlsWhoCode
fucking gold mine
>>
>>53928704
>have to meat
Looks like we found one of the drop outs.
>>
>>53928868
this drop out still doesn't rely on java to program.
>>
>>53928003
>It always takes me a couple minutes to fully understand how the program works.

Welcome to programming, don't worry, you're doing things right.
>>
>actually trying to understand the program

You're already doing better than half the CS students I've met.
>>
>>53928419
.cxx is cooler
>>
File: 1459911820780.jpg (475 KB, 852x973) Image search: [Google]
1459911820780.jpg
475 KB, 852x973
>>53928003
>>
>>53929749
actually true
>>
>>53929749
This.
>>
>>53928343
that doesnt compile in C

yes i put it in the main statement
>>
Just start with something easy like PHP.
>>
I learned C via the K&R so I could say I knew C, wrote a few fizzbuzzes, and then realized that I had nothing I wanted to program and never would unless I had some serious simulations to run, and went back to math class thinking that I should have learned fortran instead.
>>
>>53928003
>I'm trying to learn C and I'm not sure if I'm just retarded or what. It always takes me a couple minutes to fully understand how the program works.

Welcome to the real world.

I would estimate that I spent about 60% of my entire software career in "distress". In other words, banging my head against new, unknown, poorly documented APIs, byzantine codebases created by ten years worth of revolving-door engineers, etc.

The lucky people are the ones who do the same sorts of projects over and over, so they get to be in "flow" during their day. They feel super productive and their work goes by without them even noticing. It's a blissful way to work.

But yeah, you don't have enough knowledge to pick up new knowledge. You're stuck at the shitty end of the learning curve. You MIGHT be an idiot, or you MIGHT simply not have the right mind for programming, but it's more likely that you simply have to apply discipline until you gain enough competency to start forming mental associations more rapidly.
>>
>>53928439
Mine does.
>>
>>53928419
Sorry, meant .c
>>
>>53928475
wow thanks that really good explanation
>>
Why isn't it
int x = 2;
int *p_x = &x;
>>
>>53928470
Java is easier, more relevant and more productive. But I have not found any good books to learn java from.
Read C Programming: A Modern Approach
Book by Kim N. King.
Great to start off with. I really liked the first 10 chapters at least. After that I stopped, for other reasons, so I am unsure how the rest is, but it should be good.
>>
>>53928003
CS50 on edx is great IF you actually read those books in exercises.
>>
>>53928003


>>53929964
This this and this.

Try to distinguish between not actually understanding something and not
trying to understand it out of laziness or lack of applying yourself.

Each new problem I approach (I'm a semi beginner too, 5 months into C), I get intimidated and I doubt myself. Then I realise that I haven't even attempted it yet. Then I attempt it and have some trouble, and I doubt myself again. Then I think, I haven't even thought it through systematically. So I look it over as shrewdly as possible, perhaps take notes, put some real mental effort into it. Voilà. Suddenly it comes extremely naturally and I solve all problems beyond that point without a blip.

I used to think that I didn't have the mind for programming, but I no longer think that that is an inevitability. Thinking patterns can be shifted and guided, with just the smallest nudge. But the first step is getting rid of mental sloth, self doubt and pure negativity.
>>
>>53930705
I read C Plus Primer instead of the Stephen Kochan book. Both in exactly the same format and from the same publisher. I just look at the index and read up on the same subject.

What week are you on now? I'm just finishing pset2
>>
>>53929957
You could contribute to the Linux kernel.
>>
>>53928003
I started with Javascript, realized about an hour in that it was total shit, and then restarted with C++.

Fell in love with C++ after a day or so and the rest is history. It's now my main language.
>>
>>53930751
Same, started on pset2 but a client hoped in with a small project so I'm putting it off. Will check C Plus Primer, any other material you can recommend?
>>
>>53930805
My reading list:

- C Programming: A Modern Approach by K.N. King
- C Plus Primer by Stephen Prata
- The C Programming Language by Brian Kernighan and Dennis Ritchie
- Code: The Hidden Language of Computer Hardware and Software

The last one is great for learning about the pure basics of how all computers work. Very slow building but extremely enlightening. Teaches you about other number systems and hexadecimal/octal/binary arithmetic and application. Very useful in certain areas of programming.
>>
>>53928003
I started at university with C.

It took many more classes than just programming to fully understand all that's happening and how it all actually works.

An algorithm class, a class on basic computer architecture (and assembly) and a class on compilers (where we made our very own basic c compiler).

You don't really need to understand EVERYTHING to write effective C code but all this knowledge made it easier to make sense of everything and I didn't have to make these abstract depictions in my head of how pointers work, for example.
>>
#include <stdio.h>
#include <unistd.h>

int main() {
for(int i = 0; i < 100; write(1, "OP is a fag!\n", 13),i++);
return 0;
}
>>
>>53930849
Thanks, I downloaded them all.
>>
>>53930909
Well, that was damn quick.

And here's me, the goody two shoes citizen that bought the hard copies.
>>
>>53930907
You can delete stdio.h
>>
>>53930907
Wait, what?

I don't know what confuses me more; the non-existent function call or the unistd include.

>>53930931
Kek.
>>
>>53930918
Ahhh shipping to EU would take ages and it's easier for me to download it and print chapters I want to read. When I get fabulous programming job I'll buy them
>>
>>53930944
>fabulous programming job
I hope to be there with you at the Fabulous Programmers' Ministry one day, friend.

>EU
I'm in the UK. Got 'em off Amazon and Wordery. Expensive but the hardcopy is so much easier to learn from in my opinion.
>>
>>53930642
Not 100% as I'm pretty new to C, but isn't *p_x going to give the memory address of x, not the value
>>
as soon as i finish the codeacademy python course i started i plan to start learning C
>>
>>53930940
unistd for write function, It's retarded to use this way, you can use printf with stdio.h include, I did it for the lulz

for(int i = 0; i < 100; write(1, "OP is a fag!\n", 13), i++); 

==
for(int i = 0; i < 100; i++) {
write(1, "OP is a fag!\n", 13);
}


In the first one I used the comma operator.
>>
>>53931011
Had no idea. Obfuscation of C has no boundaries.
>>
>>53930987
>>53930642
The * operator dereferences the pointer and prints the value at the memory address it points to.
& is the address a variable is stored at.
Printing a pointer without * or & will print the address it points to.

p_c = &c
*p_c = c
Would both be correct.
>>
>>53930957
>I hope to be there with you at the Fabulous Programmers' Ministry one day, friend.
We are allowed to dream anon
>I'm in the UK. Got 'em off Amazon and Wordery. Expensive but the hardcopy is so much easier to learn from in my opinion.
Croatia here, prices plus VAT are hilarious. I agree on hardcopies being easier to learn from, less distraction.
>>
>>53931047
Croatia eh? On behalf of my football club, we thank you for a great footballer and manager.

Generally, all EU shipping and VAT is stupidly high but I've heard other countries get assfucked even worse.
>>
>>53931031
Obfuscation? Where? It's better to understand how the for loop works than the filthy while loop.
>>
>>53928553
>complaining that a low level language does not do everything for you, and has undefined behavior when you don't know how to read a man page
>>
>>53931123
It's not a good practice, surely. I tend to group that with obfuscation as it is generally awkward.

So using the comma operator in the 3rd fragment of the for loop allows for multiple increments/decrements and even statements and function calls?
>>
>>53930995
>learning C after learning python
Oh boy you're in for a treat
>>
>>53931199
Learning anything after C must be a lot nicer.

Can't wait.
>>
>>53931113
Slaven? He's a great guy.
>but I've heard other countries get assfucked even worse.
Sadly that's us. I hate how tech is expensive in EU, next time I visit Canada or US I'll stock up on my tech stuff.
>>
>>53931247
Great guy that's having a great season.

That's a good idea. Have you got a tablet or e-book reader? I might invest in one soon. Could just load the downloaded books onto it and at least stimulate a better reading experience somewhat.
>>
>>53931197
yep
>>
>>53931301
No, I'm so pissed at myself for not buying Kindle before my flight back. I was checking them for few books I had because I hate reading on my laptop for longer sessions. Not sure about tablets though, they seem to strain eyes more than eink. What are you considering to get?
>>
Anyone willing to explain pointers to me? I've never fully understood why should i use them, for example i have a class with no pointers in it:
class Movie{
protected:
string name;
int requiredAge:
int freeTickets;
public:
Movie(){}
Movie(string moviename, int age, int seats){
name = moviename;
requiredAge = age;
freeTickets = seats;
}
~Movie() {}
};
>>
>>53931041
That makes sense. Thank you
>>
>>53928591
code.org is for 6 year olds who like minecraft.
OP, try http://c.learncodethehardway.org/book/
>>
>>53931511
Anyone?
>>
>>53931511
Example: you need to pass a big array to a function. If you don't use a pointer, the whole thing will be copied as an argument. But if you do, you will pass only a pointer to the original array and so save valuable resources.

In C++, you should never use raw pointers. Use only smart ones.
>>
>>53931741
Thanks anon
>>
>>53931041
Thanks for clearing that up. Sadly we didn't all have the fortunate opportunity to begin programming with compiled langs.
>>
>>53930792
You put the right tools in for the job. You guys will learn that a few years in. I've had to learn a ton of languages depending on the system I was developing and the skillset of my colleagues. Java or C# are definitely easier when doing collaborative work. Especially if you force proper documentation. Op if you truly want to do this for a living you should learn C and then an assembly language. If you're just trying to learn the ropes you may be better off starting with pascal or python. FYI guys there is an excellent free course on algorithms on coursra right now taught by James sedgewick. It is based in java. Sedgewick breaks down how java is working and teaches how memory will be utilized as well as giving concrete implementations of key algorithms.
>>
>>53928439
Studying in germoney, C first and Java afterwords
>>
>>53930676
more productive
> vm language
> 0 features no delegates, lambdas, own value types
> use interfaces for "events"
> compiler forces you to catch "exceptions" but there can still be some you dont have to declare to throw/catch (nullpointer, out of range etc.)
> use the heap even for 12 byte stuff (e.g. vec3)
> takes years to start the vm
> always loads full standard lib
>>
>>53928003
try a game http://pastebin.com/AcmcNzMX
>>
>>53928003
Two things.

Translating an idea/task into a program on top of your head is something that requires a lot of practice and experience. Break everything down into the smallest problem possible and try to solve everything seperatly is the only advice i can really give you, everything else is pretty much practice.

And learning a low level language like C without background knowledge in computing just has a steep learning curve and is incredibly frustrating.
You have to apply concepts without really understanding them (at first). Before I learned C in university i had courses about digital technology, microporcessors, algorithms and data structures.
>>
>>53929871
That's the book I'm reading currently
>>
>>53928419
OP here, I don't know what that stuff means, I'm sure that's beginner stuff but I still haven't read anything on it.

Unless you mean <stdio.h>
>>
>>53928475
I don't know what that stuff means, I'm going to screenshot this for when I do read about and see if it helps me understand it better though
>>
>>53930676
OP here

How can somebody say one programming language is better than another, are they not each used for different things? Correct me if I'm wrong but I've learned that Java is for web apps, network apps, etc. (although I don't really know what each of those things are), PHP is for databases, C for UNIX and creating programs
>>
File: gwpy2.jpg (1 MB, 2250x2700) Image search: [Google]
gwpy2.jpg
1 MB, 2250x2700
>>53930995
>be me
>finish codeacademy python course
>decide to read book on python before jumping into C
>realize how little i learned from codeacademy

I suggest reading through a book on Python before moving on. Although codeacademy is great for teaching you some barebones stuff it's no where close to teaching you the full scope of the language.

Pic related is what im reading atm then im off to C/C++
>>
>>53928003
>I'm not sure if I'm just retarded or what.
Pretty much programming in a nutshell, be ready to feel like a complete fucking retard on an hourly basis, that's part of the experience.
Thread replies: 90
Thread images: 4

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.