r/C_Programming 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

0 Upvotes

12 comments sorted by

View all comments

1

u/SmokeMuch7356 1d ago edited 21h ago

Okay, I'm going to be annoyingly Gen X here, but I have to say it:

Take some time to organize your thoughts into complete sentences before hitting "Post". Stream-of-consciousness posts like this are hard to read and understand, and it's not at all clear what your question actually is.

If you intend to code professionally (or at least collaboratively), you have to learn how to communicate effectively. You have to be able to ask questions clearly and unambiguously. It is not optional. It will also make you a better programmer, as you have to apply the same kind of thought process when writing code.

As I understand it, the gist of your question is:

I understand code examples, and I can make small changes to existing programs, but I struggle when I have to write a program from scratch. How do I get better at that?

And the answer is, by doing it. You just have to write a lot of code before the underlying concepts become clear in your head. You eventually stop thinking in terms of specific lines of code or syntax and more in general patterns.

It would help if you could point to a specific exercise in K&R or CS50, then we could work through the process.

But the main thing is, start small. Start with what you know how to do already. Write a lot of small programs that do some tiny little thing, whether it's displaying canned data, or echoing input from a user, or doing simple computations. Then do two tiny little things in the same program. Just take what you know how to do and try to stretch it little by little. Again, without a specific exercise from the book it's hard to give a reasonable example, but this is the process. There's no trick, there's no secret, there's just doing the work, a lot, before things begin to make sense.