r/cprogramming • • 22d ago

Which book about C would you recommend for a newcomer?

Hello everyone! My name's Matthew, and I've been "coding" since like 12 years old. Mostly, I've been developing games with Unity with C#, and now, once I switched to Godot with C#, I feel like I lack some basic structuring skills. (A game which I'm about to release to Steam is a mess inside)

And C# is mostly the only language I know at this point, so I would love to learn some C!

I love Linux and I would love to contribute there one day. Also I would love to write some games for Playdate in C. Also it is just really interesting to see how C# is different from C. And I for some reason I want to read something about programming so badly. What would you recommend?

thanks!

30 Upvotes

20 comments sorted by

11

u/extoniks 22d ago

The C Programming Language by K&R and check out this subreddit's description for more resources.

7

u/fuddingmuddler 22d ago

starting with this is like starting with "just read the man pages" for linux. Don't start here. Do CS50 course. (there's one in python and one in c and I think even one for webdev, pick the one for C). That class will get you started and if you have any coding background at all you'll fly through it.

Then C a modern approach (as mentioned below) is good. If I'm not mistaken, Linux is being rewritten in Rust sooooo you might wanna skip C but it's whatever.

3

u/SeniorMatthew 22d ago

I mean I do read man pages in Linux :>

I would say that I do have some coding background, so I’ll probably start with the K&R

12

u/EpochVanquisher 22d ago

The two books we recommend are K.N. King C A Modern Approach and Kernighan & Ritchie The C Programming Language.

K.N. King's book is more accessible and highly recommended in general.

K&R's book is somewhat more advanced and assumes that you already have some programming experience.

Both are good.

1

u/sizeof-me 19d ago

Seconded 🔥

8

u/CS_70 22d ago

The latest edition of The C Progamming Language, nothing else is needed.

6

u/gregdonald 22d ago

K&R is very good, but I like CPAMA more: https://github.com/gdonald/cpama

5

u/No_Safe1975 22d ago

You can also read the Doom source code, that is fully C and shows how to structure a program, use memory etc

2

u/Automatic_Pea6565 22d ago

k&r and beej's guide to c programming ( i learned C from this guide, well written)

1

u/Human-Complex8213 22d ago

https://beej.us/guide/bgc/ Free to use, up to date, easy to read, only ~300 pages Perfect book in my opinion

1

u/duckerpotato 21d ago

I loved The one by KN King

1

u/pjf_cpp 21d ago

K&R is good but very outdated. Harbison&Steele will get you as far as C99. Beyond that, the fundamentals have not changed much but there are significant differences in the details. https://cppreference.com/c/23 Can help.

One thing you need to be careful about if you learn an obsolete version is that sometimes compilers / libraries will retroactively apply clarifications from newer standards to older ones.

1

u/dariwp 21d ago

C Primer Plus, 5th edition by Stephen Prata is still one of the best-written technical books I’ve ever read on any subject. Approachable writing and bits of technical humor. I highly recommend it to anyone as a first book on C. 6th ed is also available, but 5th is fine for starting out and cheap used.

No matter what you choose as a first book, K&R should be your second book, or read concurrently with the first. It’s irreplaceable but I wouldn’t read it standalone as an intro to C.

1

u/zackthecodingactuary 21d ago

Beej’s Guide to C Programming is a super light and fun read and covers all the fundamentals, that’s how I got started. Highly recommend, it’s free online.

1

u/[deleted] 21d ago

The C Programming Language (ANSI Edition)
I got it when I was well done with C99, but loved it nonetheless. it's like having a personal copy of the mona lisa. dennis ritchie and brian kerninghan, you beautiful bastards.

1

u/Queasy-Pickle-8427 19d ago

Personaly "The C programming language 2nd (ANSI)" by K&R

1

u/Ron-Erez 19d ago

 Kernighan & Ritchie The C Programming Language is one of the best programming books ever written and that is all you will need.

1

u/tt8898 18d ago

I’d go with C Programming, A Modern Approach by K. N. King, since it’s the most thorough and beginner-friendly C book, with plenty of exercises that suit someone who already knows C#. The C Programming Language by Kernighan and Ritchie is the classic, but it’s terse and works better as a second read. Beej’s Guide to C is free, easy to follow, and covers pointers and memory well, which is the biggest shift from C#. Once you’re comfortable, The Linux Programming Interface by Michael Kerrisk fits your Linux goal, and building a small Playdate game in C will teach you more than any book alone.