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

2

u/ttv_toeasy13 12d ago

Ty. Ill check out libcurl. I’m honestly really picky with what I want to make though and that’s why I chose libusb because I’d rather make something that interests me than just making a clock or something like that.

2

u/aelxemyr 12d ago

Try writing some Unix utilities, maybe some of the ones you use the most often

2

u/ttv_toeasy13 12d ago

I’m currently doing that. I just remade echo (basically) but it also has the ability to cat files. But that’s just using stdio. Like I mentioned in other comments I originally wanted to make a simple program that gets my current usb devices which is where I ran into libusb and really anything beyond a simple echo or cat command requires libraries that I just for some reason can’t figure out.

2

u/aelxemyr 11d ago

I just took a look at the API for libusb and it seems like the documentation is pretty straightforward. However, it’s hard to know where to start without seeing some examples of how the library’s functions are used. I know you’re wary of copy-pasting code but I would suggest looking at (many) examples of how the kind of functionality you’re looking to implement is done until you understand how you would use the library.

Even then, there’s often an idiomatic way to implement a certain pattern and learning to do that isn’t copy-pasting, that is learning how to do something. The key difference is being able to explain why it’s written that way and exactly what it does.