Need help with C
Posted by Wrong-Plantain-2932@reddit | learnprogramming | View on Reddit | 10 comments
Hi everyone, I'm really struggling with C. No matter how hard I try, everything seems complicated and obscure, especially pointers and memory management. I can't seem to grasp the right approach to writing code, or even understand how to write anything beyond a simple "hello world". The resources I find online tend to confuse me more than they actually help. I'm starting from absolute zero; I've never coded before. I have 3 months of free time to prepare for a highly selective coding competition where only the best make it through. Can someone tell me where to start concretely? In what order should I learn these concepts? Thanks.
peterlinddk@reddit
Stop now, you are wasting your time.
Sorry to say it that way, I would actually really like to help, but you are saying that you want to take part in a "highly selective coding competition" in 3 months, and so far you don't understand how to write anything beyond a simple "hello world".
That sounds like someone saying that they have 3 months to take part in the Olympics Gymnastic competition, but right now they have a hard time keeping their balance standing on one foot. So they would really like to learn.
Don't bother at all - you'll never learn enough in 3 months, not even if you were already pretty well versed in for-loops and functions.
Learn programming if you want to, but do it by building projects that you want to build, and do it in your own pace, so you can adapt the contents to how fast you are going. Setting an arbitrary (extremely short) deadline is a recipe for disaster and demotivation.
Less-Cheesecake-1418@reddit
I say this potentially too often: get Deitel and Deitel's C book and do every single exercise. Use only the textbook for resources until you have struggled and tried to solve anything you find especially difficult. Stay away from using AI- it will instill a false sense of understanding and confidence when you are learning. This book will give you a strong foundation in the foundations of C and introduce you to enough memory management and data structures to be able to move into advanced topics afterwards. Highly, highly recommend.
lurgi@reddit
Adding to this, if the book gives a piece of code, type it in and try to compile it and run it. Don't just read it and think "I understand". Type the thing in, compile it, get a compiler error, try to fix the error, get another compiler error, fix it, run it, and then try to figure out why you aren't getting the same answer and what you did wrong.
I am 100% not kidding about that.
johnpeters42@reddit
And don't stop there, either. Try changing something about it, even if the change seems trivial, then try to compile it and run it. If it doesn't work, then try to figure out whether you typed something wrong or understood something wrong.
Less-Cheesecake-1418@reddit
100%!
Substantial_Job_2068@reddit
Sounds doomed. Why would you want to enter that if you have zero knowledge?
Read a book, I like C Programming A Modern Approach by K.N King. And accept that you can't learn a complicated topic quickly, your issue is probably that you are trying to rush it.
SubstantialListen921@reddit
Trying to learn C in 3 months from a cold start is a Bad Idea. You will not be successful at that.
Get a book. Read it slowly. Do the exercises, which means really typing them in, by hand, and correct your syntax errors. Change the programs and watch how they behave. Be prepared to spend several years doing this.
If you really have never programmed before, consider starting with a more beginner-friendly language like Python.
aanzeijar@reddit
Then you will fail that. Whatever you learn in three months will not put you ahead of people who already know that now and use those three months to learn more. The sooner you accept that, the sooner you can learn without that burden.
As for learning C - if you do have the time, I found the best way to understand C is to go bottom-up and learn about basic computer architecture and assembly. There's a nice game called Turing Complete on Steam, it will take you a few dozen hours to complete (maybe more if you have no prior experience), but you will naturally discover why the pointers are the way they are in C.
Disastrous_Trust_166@reddit
Let Us C By Yashwant Kanetkar
grantrules@reddit
Are you following a course or just jumping around YouTube videos?
https://www.cs.sfu.ca/~ashriram/Courses/CS295/assets/books/C_Book_2nd.pdf
Follow that. If you don't understand something in the book, research it on Google and YouTube and stuff till it makes sense.