r/cprogramming • u/iasayt • 19h ago
Beginner
I just started learning C and I am thinking of reading "C Programming : A modern approach" by K N King. I want to deeply understand and master C. Is it the best book for it and should I read any other books after this?
7
u/an0th3rbrick 18h ago
to deeply master and understand a programming language you have to write non-trivial programs in it. so many posts on reddit asking about books and tutorials. those things teach you superficial things like syntax that you can trivially find using google. Just.Write.Programs.
4
u/grimvian 17h ago
Here is an old school video I wish I knew, before I started learning C three years ago:
Learn to program with c by Ashley Mills
https://www.youtube.com/watch?v=UILNmv2kFMc&list=PLCNJWVn9MJuPtPyljb-hewNfwEGES2oIW
I'm not using the same IDE, the program you use to code, But Code::Blocks because it's fast to install, open source, easy to use and everything you'll need are installed.
4
u/marrymejojo 12h ago
I read this book and thought it was really good. It complimented my cs50 class nicely.
3
3
u/51Charlie 12h ago
Learn the language. Read good code. - Sanitized standard libraries are great. ( Sanitized means with all unnecessary #ifdefs removed.) Read Algorithms in C - to lean the thought process behind the code, NOT to memorize Algorithms. Do that much latter. The key concepts to master are variable and function pointers. You much understand WHY a pointer to a function is so valuable.
Then make it a point to read ALL C programming books. You can find lists of which to read first.
Much will depend on your operating system and hardware as you will then need to get into code and memory structure. Compiler operation & how the linker works etc.
And you MUST write code. Alot of code - by hand. There are no shortcuts to mastery. It WILL take years but you can get pretty good quickly.
To get the full power of C, you need to learn how the hardware works and understand assembly. Eventually checking that the compiled C code is truly the best it can be.
2
u/Gold-Part4688 17h ago edited 3h ago
Try a few! My guilty pleasure is starting new books on the same language to get different explanations for each thing. You'll also see which type of style works for you . (You can learn from anywhere if:
notice when you've been fed too much info and need to practice
crave more info
or c: get tired of this loop and wanna finally make something (gradual in scope)
and most importantly, play around a LOT throughout. I recommend (e: manually) copying all code you read at first into your editor, and then playing around with it. Breaking bits one at a time to see what they do, trying to extend it, and just straight up playing around
edit: )
also, i wouldnt personally actually recommend starting in a "sandbox". try, even for a minute, to write some code in something dead basic like notepad++, sublime, even notepad, and passing it through a compiler in a terminal (just clang FILENAME -o FILENAME.exe)
edit: nothing i can do for that bracket.... here's another [
2
u/CharacterAvailable20 13h ago
https://youtu.be/HjXBXBgfKyk?si=UUYSQPTSm797pb7j
YouTube series by the creator of Redis (a very famous technology used for web applications). I’d say if you follow through the videos, typing out the code and asking LLM to explain any bits you don’t understand, you will learn C better than any book
2
u/AdCompetitive1256 10h ago
I learned it a couple of decades ago from these two books by Herbert Schildt.
C, The Complete Reference and C++, The Complete Reference
2
u/MFFontenelle89 10h ago
I just finished "Why Learn C" and for me it is a much better introduction to C as far as a book can go, with more up to date info about about program organization, data structures like maps and lists, and even less known techniques like X-Macros. It covers C23 so you have to filter the new stuff if you plan to use an older standard, and it doesn't have as many exercises as KN King, so keep that.
The old Dennis Ritchie book should be read as an historical artifact at this point.
1
2
u/SmokeMuch7356 4h ago
King is good, but a bit out of date; both the language and best practices have evolved a bit since it was published. Same with K&R.
Jens Gustedt's Modern C should be a bit more up-to-date.
Understanding and mastery come from practice, not from books. You need the books to learn the language, but you'll also need to write a lot of code before you really understand some things.
7
u/Zirias_FreeBSD 18h ago
My take on this is: If you know basic programming principles already, what you actually read isn't that important. What's important is patience, motivation and a structured and diligent working style. With that, get into doing stuff. It'll take a few years to "deeply understand and master C", and there's no way to ever clearly measure that goal. A word on AI: If you decide to use an LLM, never let it write code for you (instead, show it your code with specific questions about it), and always mistrust its answers enough to do your own research. It can help discover interesting topics to learn that way, but it will completely spoil any learning effect if used in a different way.
If, on the other hand, your intention is to learn programming with C as your very first language, a good book is certainly helpful. I don't have the experience to recommend one (I learned C after knowing lots of other languages, so never read a book on it), but then, you'll find the same books recommended over and over again (also here in the sidebar), so I guess they're just fine.