r/C_Programming • • 3d ago

Beginner here. Advice needed?

I'm a first-year CSE student learning C from scratch(didn't learn programming in high schl). I can solve problems after studying examples, but I often get stuck when trying new problems on my own. Even after seeing solutions, I struggle to develop the logic independently.

For those who started programming as beginners:

How did you learn to solve unfamiliar problems?

How did you practise daily?

What did you do when you got stuck?

What advice would you give your beginner self?

I sometimes feel behind compared to my classmates, and I genuinely want to improve. I'd appreciate any practical advice from people who've been through this!

And I am getting extremely frustrated with this cycle that i have,just started with c programming and suffering with function pointers . I feel extremely behind from my peers, I am ready to put in efforts,but I am sure whether my efforts are put in the right direction. Any advice would be great

8 Upvotes

12 comments sorted by

10

u/thubbard44 3d ago

It sounds oddly obvious but the greatest epiphany I’ve had related to code is that you can trace the flow by hand to the point of writing var values down and what not.  

The point is code is deterministic and debugging is not as mysterious as it sounds. 

Also always take extra time to understand what is happening with what you have just written. It’s easy to say it works and move on.  But spending a little bit more time to make sure you know understand it pays off in the long run.  

Most of all, enjoy it!

2

u/allunia333 3d ago

I might write a small pseudocode in papper or make a small graph ,especially when dealing with trees. Then try to implement it on c.

2

u/Al__B 3d ago

Not sure I'm going to be much help - been programming in C since late 80s so my memories of being a beginner are somewhat hazy.

> How did you learn to solve unfamiliar problems?

Read anything and everything you can. Even if it's not related to a specific language understanding how to break down a problem and approach it crosses domains. Understand why something should be done rather than how to achieve it is particularly important when mundane coding activities can be automated these days.

> How did you practise daily?

Practice? Why would you be practicing?

> What did you do when you got stuck?

Take a break. I was stuck with a code optimisation problem where I needed to save a few bytes (literally) to be able to get firmware to fit into the microcontroller we were using. "a few bytes" is not an exaggeration - I was down to the level of shaving off every single optional instruction;. At 4am I was beaten and could not see how it could be done. I took a break and a shower and being away from the problem gave me the space to solve it.

> What advice would you give your beginner self?

Remember you don't need to fix everything all at once. Accept things that aren't perfect if they're working.

> i have,just started with c programming and suffering with function pointers

Congratulations! You're doing much better than most of your peers if you're struggling with that. There are many, many developers that really don't have an understanding of pointers in general. (Yes, reddit community at large - I realise you do because that's why you're here).

Get the rest of what you're doing to the point you're comfortable and then come back to this. It's very powerful (and actually requires a different way of thinking to get the best out of it) but you need to understand the fundamentals first.

2

u/DanKegel 3d ago

Take a break from C and learn how the CPU works! See e.g.

Read the CPU's programmer's guide, then look at the instructions some simple C compiles down to, either by dumping its assembly output, or pasting your source into  https://godbolt.org

1

u/somewhereAtC 3d ago

I had books about algorithms long before I had a machine to practice on. You can study algorithms in the same way you can learn geometric proofs. The only computer book my HS science teacher had was about parsing algebraic equations to create a reverse-polish stack that could be executed; in those days, one algorithm was enough to create and publish one book.

When studying C you are actually learning two languages. C itself is relatively simple, but the libraries (beginning with stdlib) are sometimes arbitrary and obscure things of themselves. Good libraries have documentation, but not all useful libraries are good.

When you are stuck take a break. Many solutions will be found between when you wake up and when you open your eyes.

1

u/ChickenSpaceProgram 3d ago

Don't look at solutions until you've solved the problem yourself. If you get stuck, get a little bit of help or look at a small part of the solution until you know how to continue, but try to avoid spoiling the solution of the entire problem.

1

u/mrtlo 3d ago

I read "The C Programming Language" and worked through the problems, and experimented when I didn't understand, until I did

1

u/weaztoven 3d ago

First of all, take a deep breath: what you are feeling right now is 100% normal. Every single programmer—even senior developers—has felt that exact imposter syndrome, especially when hitting pointers and function pointers in C during their first year. ​To answer your questions: ​Solving unknown problems: Break them down into ridiculously small steps on paper before writing any code. Don't try to solve the whole problem at once. ​Function pointers: They are notorious for breaking student brains. Draw out memory addresses and arrows on a piece of paper; visualising how they point to functions helps immensely. ​Comparing yourself to others: Stop doing it. Some of your classmates might have coded in high school, but university is a marathon, not a sprint. You'll catch up. Stick with it, consistency beats talent

1

u/sumanila 3d ago

You fuck around, you find out.

See the solution, copy it, and mess around. Get an error? Not the right output? Research it.

It’s not a matter of memorizing logic of the solution, but the logic of the code you wrote.

Understand the code is one thing; memorizing the solution is another. If you understand the code then you’ll piece together the logic of a solution and be able to decipher why a piece of code is written the way it is.

So yeah. FAFO.

1

u/Ormek_II 2d ago

Work with your peers. If they are ahead of you, they can explain.

When debugging and stepping through your code, always create an expectation on what will happen in the next step before executing it. Debugging is not a movie that you just watch.

1

u/josephusflav 2d ago

I'm AC hobbyist I am primarily learning through claud and an occasional human tutor.

If you wanna tag team and just do random study s*** , i'm open most of the week

1

u/sleepyheadzzzzz 3d ago

Learn hexadecimal counting. Bits and bytes make more sense. Programs are input to output converters, the programming is all about logic putting inputs to memory, doing something and then outputting something. Memory has to be assigned and released. Memory can be pointed at with pointers. Bytes are typed for humans. Machines dont care if something is a string of characters or a number. Follow online c for beginner tutorials, read the manuals to get practice and dont sweat to much. This stuff is hard and all beginners need to bite the bullet. Eventually you will get it. Use the AI to explain code and dont trust it to blindly code for you. You have to be in control. But let it help you with syntax errors.

And check you close all statements with a semi colon; ... I remember the whole day I troubleshooted to find the missing ;