2018-07-24 Learning C

I saw @brainblasted ask about good and preferably free e-books to start with C. I started wondering. How did I learn C?

@brainblasted

I learned it by looking at the code of a small game and the GNU manuals.

The GNU C Reference Manual

The GNU C Library

These were references, not good language tutorials!

These days the early editions of the book written by the creators of C is available, for free. Who cares about how old it is. C Programming Language, 2nd Edition by Brian W. Kernighan, Dennis M. Ritchie.

C Programming Language

Search for “K&R C free” to find more interesting material like tutorials. Mark Burgess has an old C tutorial on his site, for example.

Mark Burgess

Since I believe in actual projects, the Build Your Own Text Editor booklet seems like a great idea!

Build Your Own Text Editor

@lerk mentioned the fact that C often goes hand in hand with UNIX programming and this reminded me of the fact that the online manual — the `man` pages — of your system should document both command line programs and C. This is great. Try running `man printf`, for example. These are also available online: OpenBSD manual pages, The Linux man-pages project, etc.

@lerk

OpenBSD manual pages

The Linux man-pages project

@hoergen recommended C How to Program by Deitel&Deitel, but it’s not free.

@hoergen

C How to Program

@bortzmeyer mentioned Steve Oualline and recommended *Practical C Programming* (see his non-free books). One of the free books available from his site is C Elements of Style.

@bortzmeyer

Steve Oualline

non-free books

C Elements of Style

@cstrotm posted a list of his recommendations:

@cstrotm

The C Book

PDF

The GNU C Programming Tutorial

Modern C

C Interfaces and Implementations

And finally: The Definitive C Book Guide and List.

The Definitive C Book Guide and List

Carsten also recommended Build Your Own Lisp, by Daniel Holden. It sounds fantastic: “Learn C and build your own programming language in 1000 lines of code!” But @simon_brooke said he was disappointed in the result: this is not a real Lisp! Read his review to learn more. Note the last sentence in that review where he says that this book still is “a very good, clear, engaging introduction to writing a non-trivial program in C.”

Build Your Own Lisp

@simon_brooke

review

In the discussion, Carsten also linked to the The Make-A-Lisp Process. There, you’ll find a ton of implementations in various languages, including C.

The Make-A-Lisp Process

a ton of implementations in various languages

​#Programming ​#C

Comments

(Please contact me if you want to remove your comment.)

Wow, that takes me back. I only started learning about coding in 2013 with this giant book the “C++ Primer”. I’m not even sure how I wasn’t totally intimidated by this 1000+ page monstrosity. Plus I didn’t even know what IDE meant at the time, so I was writing my code in Ubuntu’s notepad, saving as a cpp file, and compiling it through the terminal with a line of code I had to look up myself. Fun times.

– Ynas Midgard 2018-07-24 11:08 UTC

Ynas Midgard

---

Wow! That sure sounds intimidating! 😰

I think when I looked at C++ for the first time I was looking at some Borland compiler documentation which felt a thousand pages thick. But back then I was a teenager and I gave up. It took a few years until I went back, and then it was C simply because the existing game I wanted to translate into German was already written in C.

I’d never start a new project in C but there is so much existing C code out there, perhaps it will never truly disappear. 😃

– Alex Schroeder 2018-07-24 11:50 UTC

---

I know a little C but would like to be better, or find a study partner.

– Anonymous 2018-07-27 02:01 UTC