My solutions to the excersises form the Kernighan and Ritchie book The C Programming Language.
Go to file
NerdRat 0e195264d2
Added buggy makefiles to build all binaries.
2022-06-19 20:58:41 -05:00
Chapter1 Added buggy makefiles to build all binaries. 2022-06-19 20:58:41 -05:00
Makefile Added buggy makefiles to build all binaries. 2022-06-19 20:58:41 -05:00
README.md Added file descriptions to README.md 2021-04-01 16:26:37 -06:00

README.md

The C Programming Language (Kernighan & Ritchie) Book Excersises

  1. A Tutorial Introduction.
  • Chapter1/ex1-1.c: Run the hello, world program on your system. Experiment with leaving out parts of the program, to see what error messages you get.
  • Chapter1/ex1-2.c: Experiment to find out what happens when prints s argument string contains \c, where c is some character not listed above.
  • Chapter1/ex1-3.c: Modify the temperature conversion program to print a heading above the table.
  • Chapter1/ex1-4.c: Write a program to print the corresponding Celsius to Fahrenheit table.
  • Chapter1/ex1-5.c: Modify the temperature conversion program to print the table in reverse order, that is, from 300 degrees to 0.
  • Chapter1/ex1-6.c: Verify that the expression getchar() != EOF is 0 or 1.
  • Chapter1/ex1-7.c: Write a program to print the value of EOF.
  • Chapter1/ex1-8.c: Write a program to count blanks, tabs and newlines.
  • Chapter1/ex1-9.c: Write a program to copy its input to its output, replacing each string of one or more blanks by a single blank.
  • Chapter1/ex1-10.c: Write a program to copy its input to its output, replacing each tab by \t, each backspace by \b, and each backslash by \\. This makes tabs and backspaces visible in an unambiguous way.
  • Chapter1/ex1-11.c: How would you test the word count program? What kinds of input are most likely to uncover bugs if there are any?
  • Chapter1/ex1-12.c: Write a program that prints its input one word per line.
  • Chapter1/ex1-13.c: Write a program to print a histogram of the lengths of words in its input. It is easy to draw the histogram with the bars horizontal; a vertical orientation is more challenging.
  • Chapter1/ex1-13-vertical.c: Write a program to print a histogram of the lengths of words in its input. It is easy to draw the histogram with the bars horizontal; a vertical orientation is more challenging.
  • Chapter1/ex1-14.c: Write a program to print a histogram of the frequencies of different characters in its input.
  • Examples:
    • examples/hello.c: A sample "hello world" program found in page 6.
    • examples/fahr-celsius.c: A program that uses the °C = (5/9)(°F-32) formula to print the Fahrenheit-Celsius table found in page 9.
    • examples/fahr-celsius-float.c: Floating point version of the Fahrenheit-Celsius program, can be found in page 12.
    • examples/fahr-celsius-for.c: Fahrenheit-Celsius program using the for statement, found in page 13.
    • examples/fahr-celsius-symconst.c: Fahrenheit-Celsius program using symbolic constants, found in page 15.