Hacker News new | past | comments | ask | show | jobs | submit login
Best way to learn C in 2019?
40 points by comatory on Jan 8, 2019 | hide | past | favorite | 9 comments
What would be a good reference to learn C language (I presume ANSI C) today? It used to be K & R book, not sure if that is still relevant. I'm not looking for a resource that's for programming newbies but for someone who can already program in higher level languages.



* K&R Book

* Some course/book that includes gdb/compilers/modern style ect https://www.youtube.com/playlist?list=PLpIxOj-HnDsPZIJYO4U9f... which covers http://csapp.cs.cmu.edu/

* The SEI CERT C Coding Standard https://wiki.sei.cmu.edu/confluence/display/c/SEI+CERT+C+Cod... combined with C Traps and Pitfalls http://literateprogramming.com/ctraps.pdf

Really any C book you can find combined w/SEI CERT standard, there's even a functional C book from 1999 https://pdfs.semanticscholar.org/31ac/b7abaf3a1962b27be9faa2...


The 2nd edition of K&R (ANSI C) is the only enduring tome on my bookshelf.

Assuming you have some solid knowledge, that should be all you need. I find reading [John Regehr's blog](https://blog.regehr.org/) is good to get the gist of under-specified behaviours by the various compilers and what to watch out for.

Having written that, C programs that I wrote 10-20 years ago, still work without any problems. So unless you are doing some tricky stuff, like kernels or advanced device drivers, I would think that K&R will suffice. Of course, it is always a very good idea to check the compiler's warnings and edit your programs to eliminate them.


I have found 21st Century C to be a fairly current treatment: https://www.oreilly.com/library/view/21st-century-c/97814919...


I bought this on your recommendation and have to say how great it is so far, readable, just opinionated enough, reasonably concise and very pragmatic, the exact opposite of every other C book out there. It's not great for completely new programmers but it's fantastic for everyone else.

That first chapter alone and the C shebang (https://github.com/RhysU/c99sh) walkthrough put together so many ideas I've never thought or heeard of. It makes C usable in ways that you'd typical use something like python for.


21st Century C gives you a fair bit of support in terms of tools that a book that just teaches the language may lack. Knowing how to use makefiles and valgrind and other tools is extremely beneficial, IMHO.


1) Get a book on C++ and stop reading once you get to classes and other C++ features. 2) Read these in any order: "The C Puzzle Book", "Deep C Secrets", "Class Construction in C and C++" (shows what C is capable of without touching C++ features).


I would still start with K & R. If you're solid with everything there, you'll be fine.


http://c-faq.com might help too!





Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: