K&R C Exercise 1-4: Celsius to Fahrenheit Table

Exercise 1-4. Write a program to print the corresponding Celsius to Fahrenheit table. Approach K&R Chapter 1 opens with a Fahrenheit-to-Celsius table, converting F values to Celsius using C = 5 × (F − 32) / 9. This exercise asks for the inverse: step through Celsius values (0, 20, 40, …, 300) and compute the …

K&R C Exercise 1-2: Escape Sequences in printf

Exercise 1-2. Experiment to find out what happens when printf‘s argument string contains \c, where c is some character not listed above. The escape sequences K&R lists in section 1.5 are: \n (newline), \t (tab), \b (backspace), \” (double quote), and \\ (backslash). The exercise asks what happens with everything else. Approach The key insight …

K&R C Exercise 1-1c: Reading gcc Error Messages

Exercise 1-1. Run the “hello, world” program on your system. Experiment with leaving out parts of the program to see what error messages you get. This page covers the error-experimentation part of Exercise 1-1. The baseline working program is in Exercise 1-1a. Here we deliberately break it five different ways — and more importantly, learn …

K&R C Exercise 1-1b: Experimenting with printf

Exercise 1-1. Run the “hello, world” program on your system. Experiment with leaving out parts of the program to see what error messages you get. This page covers the printf side of Exercise 1-1: what the format string actually does, how escape sequences work, and what happens when you modify or multiply printf calls. For …

K&R C Exercise 1-1a: The “hello, world” Program

Exercise 1-1. Run the “hello, world” program on your system. Experiment with leaving out parts of the program to see what error messages you get. This is the very first program in The C Programming Language by Kernighan and Ritchie — and for many people, the first C program they ever type. The exercise has …

C Program to implement Warshall’s Algorithm

Data structures using C, Here we solve the Warshall’s algorithm using C Programming Language. Warshall’s algorithm enables to compute the transitive closure of the adjacency matrix of any digraph. /************************************************************ You can use all the programs on www.c-program-example.com* for personal and learning purposes. For permissions to use the* programs for commercial purposes,* contact [email protected]* To …