3 ms·
What's the best way to learn C? Any good modern book recommendations, or sites?
by mistyvales 2y ago
What's the best way to learn C? Any good modern book recommendations, or sites?
- Lyngbakr 2y agoThere's a second edition of the legendary K&R book¹ to get you started. ¹https://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628 https://www.amazon.com/Programming-Language-2nd-Brian-Kernig...
- armitron 2y agoSee my previous comment, anyone learning C from K&R should not be writing C period. That book is legendary only in the magnitude of financial damages it (directly and indirectly) enabled, caused by people who read it and thought that they could now write C.
- davidwf 2y agoI highly recommend Zed Shaw's "Learn C the Hard Way": https://learncodethehardway.org/c/ https://learncodethehardway.org/c/ I worked through this and felt well-prepared to actually use C in anger when I had to.
- armitron 2y agoTerrible overall and entirely wrong in multiple places. If you learn C from this book, you should't be writing C. The last bit is also true for K&R The C Programming Language (avoid at all costs). You're better off with: - Modern C (whatever edition is current) - Seacord's Effective C: Introduction to professional C programming - C Programming: Modern Approach 2nd edition (bible)
- lemonwaterlime 2y agoI second "Modern C" by Jen Gustedt. - Get the `cdecl` tool to build intuition about function signatures. What does "int( * ( *foo)(void))[3]" mean? - Write it yourself. - Be disciplined. Develop good hygiene with compiler flags, memory/address checks, and even fuzzing. - Read good source code such as the linux kernel. This is an amusing header file from the git source code that defines some banned functions. This is wisdom if you choose to follow it: https://github.com/git/git/blob/master/banned.h https://github.com/git/git/blob/master/banned.h - Push the language to its limits. Play with memory and data structures. Inspect everything. This book "Data-Oriented Design" by Richard Fabien is a great to explore as well. It's about organizing your data for efficient processing.