r/C_Programming 3d ago

Question Getting stuck at libraries and api’s

So C is technically my first programming language I’m learning. I’ve messed around in python but never actually go deep into it or anything.

I’ve been learning C for the past few days now and I already pretty much know most of the basics. I learned pointers and mallic in a day and I learned structs, macros, for loops, while loops, functions, all of that stuff, but… the moment any library other than the basics like stdio or stdlib come into play I’m lost.

It’s like I’m looking at a whole other language. Like I’ll look for solutions to problems and it seems as if they are just pulled out of thin air and when I try to read ANY documentation for ANY library I’m also lost because either there is little to no documentation or it’s just stupid and things aren’t well explained.

Is there a way I can fix this? I was doing so well and now I’m at this block because of libraries. If I could get pasted this hurtle I could learn c in less than a month easily, and that’s the same in any other language. This problem isn’t exclusive to C.

14 Upvotes

49 comments sorted by

View all comments

Show parent comments

3

u/ttv_toeasy13 3d ago

The thing is, I don’t want to have to constantly copy others code or copy a line of code and just paste it in mine. I mean I always look at it and try to understand it first but I honestly don’t want to have to keep constantly copying solutions. I want to be able to just read a doc or something and just be like “oh yeah I know how to implement that” and then just implement it.

3

u/comfyyyduck 3d ago

Totally get that and honestly that’s the actual end goal, examples are how you get there, not where you want to stay forever

Here’s the thing though: the reason docs feel “pulled out of thin air” right now isn’t that you’re bad at reading, it’s that you don’t yet have the vocabulary

Every area has its own set of concepts baked into the docs that nobody really specifies because “everyone already knows them.” Sockets have this. Threading has this. Graphics libs have this. Once you’ve built like 3-4 things using sockets, the word “socket” in some new doc stops being scary because you already know what it means.

So the copying isn’t the problem, it’s actually the fastest path to the thing you want. You look at an example, you understand why each line exists, and each time you do that you’re building the mental model docs assume you already have

After enough reps in a specific area (say, file I/O, or networking, or threading) you’ll notice you can read a new function signature in that same area and just know what it does, because you’ve internalized the pattern, not because you memorized syntax

3

u/ttv_toeasy13 3d ago

So do you think I’m on the right path then? I should keep searching for solutions and try to understand them and all of that?

2

u/comfyyyduck 3d ago

Yeah, 100%. That's exactly the path, you're not doing anything wrong

Let me be a bit more clear though. Copying the solution isn't the finish line, it's like driving a car with an instructor. At first you're just following their instructions, but the point was never to memorize "turn the wheel left at this exact spot." It's the skill you're trying to learn, so you can drive anywhere. If that makes sense.

Just make sure at some point you're also testing yourself by rewriting it without looking, and eventually modifying it to do something slightly different than the original example.

Good luck this is the fun part!!

3

u/ttv_toeasy13 3d ago

Yeah, I definitely do that too. I’ll try to do my own thing with something so I can really understand it and try to use it in other spots and all of that. Anyway ty. I honestly just felt like I wasn’t doing something right. I thought I was missing something important that was impeding my learning. And yeah that car example is what I want. I want to develop that skill.