Lurker News
I have 15+ years of experience in many languages: javascript, python, go, etc.

I can write C, but I'm not confident I'm doing it the right way. There are now decades of forums and blogs I can search through, but I'd love to have a single, clean, clear source of truth for recommendations on how to write C code.
I've started reading "Modern C" by Jens Gustedt. I'm not sure if this is the closest to a modern source of truth.
Note, I'd like my C code to work on Windows, which possibly restricts the "right way" to features provided by C89. But again, I'm not sure, the internet is super clear on this.
Thanks for the tips!

Comments (199) 63 threads

Earlier comments
6c696e75781 reply#
The C FAQ used to be a good place to start. Note, used to be:

http://c-faq.com/
What did you want to do on Windows? I think this depends as much on the compiler as the code.

camgunz#
Second this. Read it all more than once; the insights it will give you into C are so valuable.

I'll also recommend C++ FQAs [1]. It's C++, yeah, but it's relevant to C in many places, and since a lot of systems programming now uses C++ as the lingua franca, it's a good, entertaining resource.
1: http://yosefk.com/c++fqa/

thefourthchime#
I would read K&R, it’s a right of passage. Look at some of the larger open source projects for how to organize and manage a large c project.

And practice pointers. Get really comfortable with how memory works.

_benj#
I’m currently learning C myself and something that I realized is that often the hard part to learn is not C the language but the domain in which is being used.

For example, I’m trying to learn Linux drivers or embedded programming and I thought that I’d find in a C book information about registers and such, but registers don’t really belong to the C domain but to the hardware domain.
Thus, maybe find a way to clarify what you want to use C for and then learn those domain problems and how C solves them.

Load more comments