Settings

Theme

Best way to learn C in 2019?

40 points by comatory 7 years ago · 9 comments · 1 min read


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.

hackermailman 7 years ago

* 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...

CyberFonic 7 years ago

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.

bsg75 7 years ago

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

  • flukus 7 years ago

    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.

  • lsiebert 7 years ago

    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.

phendrenad2 7 years ago

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).

kotrunga 7 years ago

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

50 7 years ago

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

weRven0m 7 years ago

Go to 42

https://www.42.us.org/

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection