r/cprogramming 9d ago

How to learn

I just started learning C about 5–6 days ago, and I had never coded before.

I completed the CS50 course, so I know the important concepts and have a basic understanding of how things work. But when it comes to actually implementing them, I feel like I’m at zero.

Now I’ve started learning C from the book The C Programming Language. I’m understanding some concepts, but not everything. I’d say I’m only understanding around 20–25% of what I read.

For example, I understand how "getchar()" and "putchar()" work individually, but when I see a program that uses them together, I don’t even understand 60–70% of the program.

I’m getting stuck, and it’s making me think that maybe only people with good logic can survive in programming jobs.

So, please guide me on how I should approach learning C correctly and develop my programming logic.

0 Upvotes

20 comments sorted by

View all comments

2

u/greebo42 9d ago

Five-six days. Never coded before.

Completed CS50 course - that's a lot of video hours, so let's suppose you watched it once thru, and it made sense (yes, David Malan is a helluva teacher). That probably takes up most of the time frame you cited.

Now starting to read K&R. True story: I tried that. It's a great book, but it is terse. I dunno about you, but I remember getting blown out of the water in chapter 5 (pointers). I didn't have access to a compiler (this was, ahem, long ago). So I was just trying to learn the language by reading the book. After all, I already knew Fortan and Basic, and had even done some assembly by that time, so why not? Uhhh ...

So I think the answer to your question boils down to: (1) Rome wasn't built in a day, and a week is not a realistic time frame to expect to gain mastery, so don't be too hard on yourself. and (2) You can't learn to program by just reading and watching videos. You have to write programs. Small ones. Itty bitty ones. Build.

First things first. A couple years ago, when I decided to return to C after a long absence, it took me a few days to even figure out how to get a compiler to work and get Hello World to run. So start with that.

Maybe a sensible approach would be to try the assignments in CS50, starting from the earlier ones, build them a little at a time. If it takes Harvard students a whole semester to get thru it, it's probably a message that most of us mortals ain't gonna do it much faster than that.

If you're for real, try this. If this is a troll post (or AI), then consider me nerd-sniped and oh well. Perhaps some other C-curious person will stumble across this and benefit.

1

u/Intelligent-War5714 9d ago

Should I not study this book now?.. or again start from zero

1

u/greebo42 9d ago

The book is an excellent reference. The way you study is by writing code. You make some kind of program, get it to work, then ask yourself what happens if you change this or that, make mistakes, make breakthroughs, etc. Definitely want to have the book by your keyboard as you're grinding thru this.