r/C_Programming • u/pjl1967 • Oct 29 '25
New book: Why Learn C
As the author, I humbly announce my new book "Why Learn C":
If you’re thinking, “Why a book on C?,” I address that in the book’s Preface, an excerpt of which follows:
“Should I still learn C?”
That’s a question I see asked by many beginning (and some intermediate) programmers. Since you’re reading this preface, perhaps you have the same question. Considering that C was created in 1972 and that many more modern languages have been created since, it’s a fair question.
Somewhat obviously (since this book exists), I believe the answer is “Yes.” Why? A few reasons:
- Modern languages have many features for things like data structures (e.g., dynamic arrays, lists, maps), flow control (dynamic dispatch, exceptions), and algorithms (e.g., counting, iteration, searching, selection, sorting) as part of the language (either directly built-in or readily available via their standard libraries). While convenient, the way in which those features are implemented “behind the curtain” has to be done in a general way to be applicable to a wide variety of programs. Most of the time, they work just fine. However, occasionally, they don’t. C is a fairly minimal language and has almost none of those things. If you want any of them, you’re likely going to have to implement them yourself. While onerous, you’ll be able to tailor your implementations to your circumstances. Knowledge of how to implement such features from scratch and understanding the trade-offs will serve you well even when programming in other languages because you’ll have insight as to how their features are implemented.
- Many systems and some scripting languages (e.g., Python) provide C APIs for implementing extensions. If you ever want to write your own, you’ll need to know C.
- Many open-source software packages upon which modern computers and the Internet still depend are written in C including Apache, cURL, Exim, Git, the GNU compiler collection, Linux, OpenSSL, Postfix, PostgreSQL, Python, Sendmail, Wireshark, Zlib, and many others. If you ever want either to understand how those work or contribute to them, you’ll need to know C.
- Embedded systems are largely developed in C (or C++, but with restrictions). If you ever want to work on embedded systems, you’ll likely need to know C.
- C has influenced more languages than any other (except ALGOL). If, in addition to programming, you also have an interest in programming languages in general or from a historical perspective, you should know C.
I’m not suggesting that you should learn C intending to switch to it as your primary programming language nor that you should implement your next big project in C. Programming languages are tools and the best tool should always be used for a given job. If you need to do any of the things listed in reasons 2–4 above, C will likely be the best tool for the job.
“Wouldn’t learning C++ be good enough?”
“I already know C++. Isn’t that good enough?”
Since C++ has supplanted C in many cases, both of those are fair questions. The answer to both is “No.” Why? A couple of reasons:
- Even though C++ is based on C, their similarities are superficial. Aside from sharing some keywords, basic syntax, and toolchain, they are very different languages. The ways in which you get things done in C is necessarily different from C++ due to C’s minimal features.
- From the perspective of learning how features are implemented behind the curtain, C++ is already too high-level since the language has modern features and its standard library contains several data structures and many algorithms.
“Why this book?”
If all that has convinced you that C is still worth learning, the last question is “Why this book?” Considering that The C Programming Language (known as “K&R”) is the classic book for learning C, that too is a fair question.
The second (and last) edition of K&R was published in 1988 based on the then draft of the first ANSI standard of C (C89). C has evolved (slowly) since with the C95, C99, C11, C17, and C23 standards. This book covers them all.
This book is split into three parts:
- Learning C: teaches the C23 standard of C, includes many additional notes on C’s history and philosophy, and also includes best-practices I’ve learned over my thirty-five year career.
- Selected Topics: explains several additional advanced or obscure parts of C that I’ve found not to be explained well elsewhere, if at all.
- Extended Examples: gives detailed examples with full source code of how features in other languages might be implemented including discussion of the trade-offs involved so you can understand what’s really going on behind the curtain in whatever language you program in.
Additionally, there’s an appendix that lists differences between C23 and C17, the previous version of C.
Motivation
I’ve been writing articles for my blog, chiefly on C and C++ programming, since 2017. Unlike far too many other programming blogs, I wanted to write about either advanced or obscure topics, or topics that are often explained incompletely or incorrectly elsewhere. Indeed, many of the topics I’ve written about were motivated by me reading poor articles elsewhere and thinking, “I can do better.” Since each article is focused on a single topic, I invariably go deep into the weeds on that topic.
Those articles explaining topics incompletely or incorrectly elsewhere were sometimes on really basic topics, like variables, arrays, pointers, etc. Again, I thought, “I can do better,” so I wrote a whole book that teaches all of C from the ground up.
More about “Why Learn C”
My book is 404 pages. (For comparison, the second edition of K&R is 272 pages.) Not mentioned in the Preface excerpt is the fact that the book contains over 100 inline notes containing commentary, explanations for why something is the way it is, historical context, and personal opinion, i.e., things not essential for learning C, but nonetheless interesting (hopefully), for example:
- Why does the first program ever shown in any programming language print “hello, world?”
- Why does the C compiler generate a file named
a.outby default? - Why is
_Boolspelled like that? - Why does C have such a convoluted declaration syntax?
- The book does borrow a few topics from my blog, but they’ve been reworked into a cohesive whole along with a majority of all-new material.
Just for fun, the book also contains a few apt movie and TV quotes ranging from The Matrix to The Simpsons and several instances of an easter egg homage to Ritchie and The Hitchhiker’s Guide to the Galaxy. (See if you can find them!)
3
u/onusofstrife Mar 08 '26
I just picked up your book. Honestly mostly based on these posts here on reddit. I've been wanting to work through a language book lately.
I'm not a programmer in any professional manner. I read code a few times a year at my job but that's really the extent. I took two levels of c++, and a python course in college nearly 15 years ago.
I'm finishing up the first chapter and I am learning interesting things. At first it thought I was going off the deep end. But outside of the bit shift I was able to follow along and learn things. The nods to c history are always a blast.
Thanks!
14
u/balemarthy Oct 29 '25 edited Oct 29 '25
Great introduction to your book and happy to see the excerpt from preface too.
I am not aware that there is C23 (damn I am living under a rock) 272 pages VS 404 pages is fair deal.
So under 600 pages the complete C journey is getting sorted ( I Removed some pages for contents and other mandatory pages)
13
u/AccomplishedSugar490 Oct 29 '25
I see a technical rationale for learning C, and it’s probably accurate and even fun. But do you touch on the real reason to learn C - which isn’t so you know C but so you can become a better human being?
1
u/Working_Explorer_129 Oct 29 '25
Hello, it’s nice that you’re taking your passion for the language and providing others with your insight. If I may, what would be the case for choosing this book over the Modern C 3rd ed?
1
u/Elias_Caplan Oct 29 '25
Please tell me you teach how to program C securely.
1
u/ProducerMatt Oct 30 '25
No relation to Michael W Lucas, I assume? I'm just saying, in an era of terrible nonfiction writing, we could use long-lost brothers with supernatural educational powers. :) I look forward to checking out your book when I have a chance.
1
u/mikeblas Oct 30 '25
Grats on publishing! I was it working with APress?
1
u/Brilliant-Cod-201 Nov 01 '25
Hey I am currently trying to get back into C after a long while and after doing some research I have started working with K&Rs 2nd edition, which I actually enjoy but especially things like the references to Fortran and pascal haven’t aged well. Would you say that your book would be good follow up to expand on, as well as adding more modern features not yet available during the book? I have been trying to look at the ISO standard for C but to learning it isn’t as helpful as I thought.
1
u/CastroEulis145 Feb 07 '26 edited Feb 07 '26
I'm definitely interested but $50 is a little steep right now. Is it realllllly worth it? Lol
I just started my journey of building a homelab and I want this thing to be a full fledged banging system that I can call mostly my own creation.
So now I went from never wanting to learn a programming language to I really need to learn C, rust, go, and python and I guess JavaScript or something. But learning C now seems to be a big priority for me so I can learn my system and control it myself. I want the full stack treatment and it seems to start with C.
3
u/JohnDoe1234567890000 Oct 29 '25
Congrats!
2
u/NoSignificance2268 Jun 14 '26
Hey jsut got the book based on the recommendations, and just started learning a bit of CS (bootcamp grad). It looks really good interesting and easy to read so far. Will keep posted when/if I finish
0
u/TheAncientGeek Oct 29 '25 edited Oct 29 '25
There's a need to have at least one compiled language -- you can't have interpreted languages all the way down.
Historically , that's been mostly C.
It's not clear that it should continue being C. It's much harder to argue for C over Rust for greenfield development.
1
u/francespos01 Oct 29 '25
Love to see a C23 book. Hope it will be a success. Good luck!
1
u/spacextheclockmaster Oct 29 '25
Amazing!
1
u/kAROBsTUIt Oct 30 '25 edited Nov 02 '25
Congratulations! I am interested, and it's really cool to have a chance to talk to you as the author here.
I have an elementary understanding (and experience) with C, learning it initially in CS101 in college over 10 years ago. More recently, I've been working on a C extension for my Python application to drive SPI hardware on a board I designed. I like that your book appears to be tailored to those with development experience, and passes on the programming fundamentals. (Is that a correct assessment?)
ChatGPT has been atrocious (in my experience) with asking questions about C and associated best practices. So, I'm seeking a proper C book. (PS - I tried C Programming: A Modern Approach from Amazon, and twice I purchased it brand new, yet received a clearly used book from Amazon, so I returned them)
Would you recommend C23 as the standard I really use and commit to learning, in the context of Python Extensions and embedded-adjacent development?
Thank you!
Edit: Damn, no response from OP. Oh well, I'll just continue using the PDF version of "The C Programming Language, 2nd Edition" available free on Github:
https://raw.githubusercontent.com/auspbro/ebook-c/master/The.C.Programming.Language.2Nd.Ed%20Prentice.Hall.Brian.W.Kernighan.and.Dennis.M.Ritchie..pdf
1
u/fatgoat76 Oct 31 '25
Thank you! This looks very interesting
1
u/wsppan Nov 01 '25
You forgot the most important reason to lean C. C Isn't A Programming Language Anymore. it’s a protocol that every general-purpose programming language needs to speak.
1
u/TechnoCalibrator Nov 02 '25
“I already know C++. Isn’t that good enough?” - sure buddy
1
u/orbiteapot Nov 03 '25
Really nice! I appreciate your writings in DEV Community and I would have bought the book, had I lived in the US (currency conversion + taxes make it really expensive here, in Brazil).
1
u/vitamin_CPP Nov 03 '25
Love your blog. Happy to buy a copy of your book!
1
u/Individual_Key4701 Nov 06 '25
Because it's there.
0
u/[deleted] Oct 29 '25
[deleted] — view deleted comment