
Even experienced C programmers can get themselves into trouble if they're not certain of what they're doing. Each of the book's many examples has trapped a professional programmer. C Traps and Pitfalls aims to encourage defensive programming by showing how other people, even experienced professionals, have gotten themselves into trouble. These mistakes are generally easy to avoid once seen and understood, so the emphasis is on specific examples rather than generalities. Covers lexical, syntactic, and semantic pitfalls, linking and library problems, preprocessor, and portability pitfalls.
In my experience C has a lot of simple grammar, a commonly-held simple (wrong) execution model, and a lot more complexity lurking underneath where it can't be so easily seen.
(One of my formative learning books was https://en.wikipedia.org/wiki/C_Traps_and_Pitfalls , valid in the 90s and mostly still valid today)
If you are learning programming (and who among us isn't?), the code examples stink to high heaven. No really. Don't program like that! K&R didn't! If you're learning programming and C it will teach you a bunch of really bad habits /because/ it is a book for experienced programmers with fully developed taste and the examples were designed to illustrate a particular facet of the language as pithily as possible. It's great for that.
I realize any criticism of the sacred texts will result in inspiring revulsion and possibly bile among those who think of such things as above criticism and any commentary is about the shortcomings of the commentator not the holy book but there it is... It's 2022 and I'm old enough to take it. ;-)
Alistair Moffat "Programming, Problem Solving and Abstraction" is one I found that seems better to learn C programming. Maybe other people have better recommendations than that..?
Separate to that "The C Puzzle Book" is superb when you're learning to really thoroughly understand pointers, arrays and so on. Koenig's "C Traps and Pitfalls" isn't bad for some of the dark corners.
Next you should checkout Data Structures and Program Design in C by Kruse, Tondo et al. This book teaches Algorithms/Data Structures but using good structuring techniques in C. Follow up with Sedgewick's books.
To learn about C and Low-level details there is nothing better than Computer Systems: A Programmer's Perspective by Bryant and O'Hallaron.
Finally, to learn about the dark corners of C checkout C Traps and Pitfalls by Andrew Koenig and Expert C Programming: Deep C Secrets by Peter Van Der Linden.
That being said, if you're crazy enough to write a C replacement in the first place, then maybe you'll be crazy enough to incorporate my crazy suggestion for function specialization. In functional languages, given a function f(w,x,y,z) with many parameters, it's straightforward to define another function g(a,b) with fewer parameters as being equal to f(H,b,a,K), a more general function specialized by fixed constants for some of the parameters and arbitrary permutations of the others. I'd like to be able to express the transformation that takes a pointer to the general function f as input and returns a pointer to the specialized function g, such that the pointer to g can be used in the same context as any other pointer to a function of that arity and type defined the normal way. I'd like it to be possible in a library written be me operating on user-supplied pointers to functions not known in advance, I'd like to avoid workarounds such as global static variables or thread-specific storage, and I'd like you to convince me that your implementation of this feature is too simple to be wrong.
[1] "Some Were Meant for C" by Stephen Kell https://doi.org/10.1145/3133850.3133867
[2] "C Traps and Pitfalls" by Andrew Koenig
edit: typo