learn through suffering C language learn through suffering 
C language

K&R

The C Programming Language

If you aspire to learn C, you've likely heard of a book called K&R.
K&R is the world's first genuinely good explanation of the C language.
This book became a huge success in the industry, partly because it was written by one of the original developers of the C language.
K&R is sometimes called the best-selling book in the computer industry.

This book delves into the very fine details of the C language.
Back then, there weren't any proper standards for the C language.
It was to the extent that a C compiler was built based on this K&R.

However, the author does not recommend that you read K&R.
Actually, or rather, you shouldn't read it.

The first reason is that the explanation is too unclear.
I think you're going to need a pretty good understanding of C to be able to read this book.
It seems the books themselves weren't intended to be read by beginners.

The second reason is the excessive use of pointers within the sample program.
For example, as an implementation of strcpy (string copy),

sum.c
/* Array Edition */
void strcpy(char* s, char* t)
{
    int i;

    i = 0;
    while ((s[i] = t[i]) != '\0') i++;
}

Despite the introduction of a clearer example than those shown below,

sum.c
/* Pointer Edition */
void strcpy(char* s, char* t)
{
    while (*s++ = *t++);
}

which introduces a very convoluted example, and furthermore,

Quoted from The C Programming Language, 2nd Edition
This may seem difficult to grasp at first glance, but this notation is quite convenient. Since it often appears in C programs, such conventions should be mastered.

I've noticed instances where people are deliberately encouraged to use obscure or unnecessarily complicated writing.

A third reason is that programs like these are convenient and fast, so it's worth remembering them.
It's an incredibly outdated explanation.

Such programs being fast is a thing of the past.
Currently, compilers optimize away loops of this magnitude.
Unless you write in a particularly unconventional way, there's hardly any difference in speed.


Results verified with the assembler.
This may seem difficult to grasp at first glance, but this notation is quite convenient. Since it often appears in C programs, such conventions should be mastered.


K&R was certainly an excellent reference book back when there were no other C language guides available.
Reading K&R tends to poison my mind and make me want to write tricky programs.
Furthermore, it's explained in excessive detail, which makes it prone to unnecessary misunderstandings.

I think it's better to read K&R as a quick reference rather than a tutorial.
K&R is a slim volume, but it still covers all the features of the C language.
Not a bad thing to carry around as a mobile reference.

Furthermore, you can also use K&R's sometimes obscure explanations to check your own understanding.
If you understand K&R, you can probably say you have a decent grasp of the C language.


About This Site

Learning C language through suffering (Kushi C) is
This is the definitive introduction to the C language.
It systematically explains the basic functions of the C language.
The quality is equal to or higher than commercially available books.


Part 0: Program Overview

  1. What is a program?



Chapter 3: Displaying on the Screen

  1. String Display
  2. line break
  3. Practice Problem 3

Chapter 4: Displaying and Calculating Numbers

  1. Display of numbers
  2. Basic calculations
  3. Numeric types
  4. Practice Problem 4


Chapter 6: Input from the Keyboard

  1. input function
  2. The fear of input
  3. Practice Problem 6



Chapter 9: Repeating a Fixed Number of Times

  1. Iterative sentence
  2. How Loops Work
  3. Practice Problem 9

Chapter 10: Repeating Without Knowing the Number of Times

  1. Unspecified loop
  2. Input validation
  3. Practice Problem 10



Chapter 13: Handling Multiple Variables at Once

  1. Handling multiple variables collectively.
  2. Arrays
  3. Practice Problem 13






Chapter 19: Dynamic Arrays

  1. Create arrays freely.
  2. Practice Problem 19

Loading comment system...