The Bible in C?
K&R is the world's first decent C language manual.
The book was a huge hit in the industry, in part because it was written by the C language developers themselves.
K&R is also considered the computer industry's biggest bestseller.
The book goes into the very fine details of the C language and explains
At that time, there was no such thing as a decent standard for the C language.
A C compiler was even built based on this K&R.
However, the author does not recommend that everyone read K&R.
Or, rather, do not read it.
The first reason is that the explanation is too difficult to understand.
You would have to be quite familiar with the C language to read this book.
To begin with, the book itself does not seem to be designed to be read by beginners.
The second reason is the abuse of pointers in the sample programs.
For example, an example implementation of strcpy (string copy) is
/* Array version */
void strcpy(char* s, char* t)
i = 0;
while ((s[i] = t[i]) ! = '\0') i++;
Despite the fact that a clear example (rather than the next sample shown) is presented, the
/* pointer version */
void strcpy(char* s, char* t)
while (*s++ = *t++);
And yet, it presents a very confusing example of a
These idioms should be mastered for the reason that they are often found in C programs.
We see situations where people are encouraged to go out of their way to write in a way that is difficult to understand, such as
The third reason is that programs like the above are convenient and fast, so you should definitely learn them.
The explanation is too outdated.
It was a long time ago that these programs were fast.
Nowadays, with compiler optimizations, loop programs of this magnitude
There is almost no difference in speed unless it is written in a very irregular way.
We checked by implementing and measuring our own benchmark program.
However, to see if they were equivalent at the assembler level, we tested them on the latest VC (VC2005).
The pointer version is about half the amount of code, with only one jump instruction, and
The code was found to be more compact than the array version.
In other words, it appears that even today there is room for speedup with the latter writing style.
However, I think that arrays are fine except in areas where you want to achieve special speedups.
Modern CPUs operate in complex ways, converting, reordering, and anticipating instructions, and
Assembler-level customization is less likely to show up as a speed difference.
K&R was indeed an excellent manual at a time when no other C manuals were available.
When you read K&R, you tend to be poisoned by its content and create tricky programs.
Moreover, the oddly detailed explanations can easily lead to unnecessary misunderstandings.
The author recommends that K&R be read as a simple reference rather than as an instruction manual.
K&R is a thin book, but it still explains the full functionality of the C language, so
Not bad if you want to carry it around as a portable reference.
In addition, by taking advantage of K&R's difficult-to-understand explanations, it can be used to check one's own abilities.
If you can understand K&R, it is safe to say that you have some C language skills.
About this Site
The C language (bitter C), which is learned by suffering, is
This is the definitive C language introductory site.
It systematically explains the basic functions of the C language and
It is as complete as or more complete than any book on the market.