"The C Programming Language", 2nd edition, Kernighan and Ritchie

Answers to Exercises

Maintained by Richard Heathfield

Last updated: 12 March 2002

This site was inaugurated on 1 January 2000 as a repository for definitive answers to the exercises in "The C Programming Language" by Kernighan and Ritchie (2nd edition) - ISBN 0-13-110362-8. Since it's a relatively new site, not all of the exercises have been done. That will change over time, of course.

Naturally, it's not impossible that you might notice a mistake, or be able to think of a better solution than the one presented on this site. If so, please let me know, and I'll consider your amendment for inclusion. I will try my best to ensure that full credit is given to all contributors to this site. Any uncredited listings (modulo errors of omission) are supplied by me personally, so beware! Complaints to email, please...

Maintenance History
Bugs and Fixes
Copyright Issues
Naming Conventions
Download all existing non-essay solutions (C files, zipped, 116,202 bytes).
Unsolved exercises


Chapter 1 - A Tutorial Introduction
Chapter 2 - Types, Operators and Expressions
Chapter 3 - Control Flow
Chapter 4 - Functions and Program Structure
Chapter 5 - Pointers and Arrays
Chapter 6 - Structures
Chapter 7 - Input and Output
Chapter 8 - The UNIX System Interface


You are visitor number - call again soon!