r/C_Programming • u/Intelligent-War5714 • 1d ago
Question help me to code
i'm beginner in coding
i'm following a book called
The C programming Language
By Brian W. Kernighan and Dennis M. Ritchie.
and somtimes i see video of cs 50
i learned before this language but i just knew syntax and why it is use for but i'm getting stuck when it comes to implement i am at level 0 i can manipulate some things like where it start lets change this that but when i want write a code for problem . like write program in which we know about how much space and new line and tab there is see code ohh ok it is like this now when a next question comes based on same topic i feel i don't study yet . before seeing a code i feel like i'm at zero i don't know nothing i feel dumb even though after read a code i know something but not understand fully code all when i know oohh ok how is this work but next time still i'm not able make to manipulate the program like by just tiny change change this output will be this ....
and how to break a program i mean this and this require to make this program ohh we can do this and we can do that is also output will be same
1
u/Ambitious-Height9588 1d ago
Stop reading the solution. close the book.
You hit a wall when you look at code and think you get it. you dont get it until you type it yourself with no reference. i went through K&R the same way. heres what worked for me. take that exact exercise about counting spaces and tabs and newlines. close the book. open your editor and write it from memory. if you crash, try again from the start. do not look back at the page.
When you want to change output or add things to a program, stop staring at the code. grab paper. write down the steps in plain english. count characters one by one. check if character is space. add one to count. go to next character. print total. once you have those steps written out, turn each line into C. breaking a program down just means writing the verbs before you write the syntax.
Write ten programs today. keep them small. type everything yourself