-
How really learn c?
So i have read about 2 books about c, currentlybtaking a c class but im having a bit of a learning issue :(
When the class first stared it was very easy, i got everything and was able to do all book excersices with out problem, printf, scanf, ifs, for, do, all that was pretty easy. Then mid semester came in harder loops, struts, pointers, etc stared to appear and all the sudden im completelly lost :(
How did you guys learn this second part of c??? Is practice practice practice the real solution?????
-
Err.. what exactly are 'harder loops' ? Once you understand the logic behind looping, all loops are similar to make.
Practice, practice, practice -- like a robot may not be the ideal solution..but unless you really enjoy programming, it is the only solution.
If you do, try making a nice project just for the fun of it...and once you get to see something of your creation work, everything will start falling into place.
-
I made a pact with the devil. But I suppose you could practice.
Actually, pointers are often confusing to newbies. Learning a little assembly language and how computers actually work helps a lot.
-
Practice.
Have something to practice on (exercises get boring quickly and rarely have real-world value). Start with something simple and FIND OUT how to do it in C (best way to learn it to posit a problem, try solutions, and see what happens - best way to reinforce "what works" in your head). My usual candidate is a Yahtzee or similar dice game. Easy, simple, can use lots of loops, conditions, randomness, input, output, etc. and quite simple to understand the game itself.
What, exactly, is hard to understand about a loop? Why not see how others are using them? Why not see what they are generally used for? Why not try to make your own version of one of those codes having seen an example?
Expecting to read a book and then, when you get to the end, "know" anything about the subject at hand is naive. It won't happen. You'll have a temporary familiarity with the subject but you WON'T learn.
Seriously - find yourself a simple project that you're interested in and do it and don't stop until it's done. Noughts and crosses, Yahtzee, a membership database, any of the classic simple program examples. If you truly don't pick it up, it means you aren't DOING, just reading. I can read a book on how to drive a supertanker. It doesn't mean I know how to do it. It's the same for programming, which is a PURELY intellectual exercise.
-
Write a linked list. That will help you to understand structs and pointers.
Linked Lists in C Tutorial - Cprogramming.com
-
Being self-taught works best. Then you can think of the teacher really only being there to push you in the right direction and introduce you to new things. But if you really want to learn it then you will just make time to do so and learn everything your own way.