Answers to The C Programming Language by Kernighan and Ritchie


Welcome to the C Answers Site. I created this as a tool to use while reading (and re-reading) the classic C programming language text, The C Programming Language by Kernighan and Ritchie. I found Richard Heathfield's site and thought it best served by a wiki. I couldn't get in touch with him and am in a sense violating his copyright. I've made effort to reproduce his work, and the work of the original contributors, unaltered. Any additional contributions or edits will be referenced by the wiki's edit changelog.

Enjoy!
sig.gif
Yong Joseph Bakos

Credits


Purpose


From the Original C Answers Site (old)

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...

The original C Answers Site was last updated 12 March 2002.

Meta

Errata for the 2nd Edition of K & R
Maintenance History (old)
Contributors (old)
Bugs and Fixes (old)
Copyright Issues (old)
Naming Conventions (old)
All Existing Non-essay Solutions (C files, zipped, 116k).
Unsolved exercises (old)

Examples and Solutions by Chapter

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