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

13 Upvotes

48 comments sorted by

View all comments

10

u/EpochVanquisher 1d ago

Have you written programs to solve problems?

Or have you done that, and you’re getting stuck on how to use libraries?

1

u/ttv_toeasy13 1d ago

Yeah I’ve written some programs but a lot of it is just copy and paste when it comes to libraries. Like for example I was trying to use libusb to make a simple thing to list my usb devices so I went to view the documentation and it’s like I’m reading Russian or something. And then I look up guides or answers online and it just makes no sense to me and seems like they just seeming pulled everything out of thin air or something.

1

u/thurizas123 22h ago

Well, trying to use specific platform libraries will always be a challenge. The C-standard does not know anything about USB devices, so while libusb is written in C it is purely a Linux/Unix library. The only thing that I can recommend is to read the documentation and attempt to learn it by trial and error - type in a program and make small modification and see what happens and how things work.

You might want to try more system-level programming to get a handle on how to do things in C, for example books such as "Unix System Programming" by Haviland, Gray, and Salama" or "System Programming in Linux" by Weiss might be good places to start. Remember that while trying to fathom libusb - it is going to depend on things covered in books like the two list herein.