An Introduction to the C Programming Language
and Software Design

Tim Bailey 2005

This textbook is a thorough introduction to the C programming language, with an emphasis on software design and code organisation. Many introductory textbooks teach language syntax but do not show how to apply the language features to build scalable modular software systems. This text attempts to fill the gap.

Download the textbook.

This text is currently a draft (0.6) and will be revised as time permits; some parts are more complete than others. Any constructive comments are most welcome. I have a list of intended extensions and modifications. I also maintain a list of errata for the current draft.

Source Code

Listed below is complete source code for selected programs from my textbook.

  • Code from chapters 1 to 3. [download]
  • Tic-Tac-Toe game from chapter 6. [download]
  • Matrices version 1 from chapter 9. [download]
  • Matrices version 2 with file-modular design. [download]
  • Expandable array version 1 from chapter 9. [download]
  • Expandable array version 2 from chapter 11. [download]
  • Expandable array version 3 from chapter 14. [download]
  • Singly linked list from chapter 11. [download]
  • Doubly linked list from chapter 15. [download]
  • Circular buffer from chapter 15. [download]
  • Stack from chapter 15. [download]
  • Queue from chapter 15. [download]
  • Binary tree from chapter 15. [download]
  • Hash table from chapter 15. [download]

Notice that, for variety, some of the implementations differ from the code that appears in the textbook. Also, some are significantly extended so as to demonstrate additional design ideas. In particular, the doubly-linked list implementation uses an arena and a free-list to manage memory allocation.

Disclaimer: While some effort has been made to ensure this code is correct, it has not undergone stringent testing, and it comes without any form of guarantee.

[Tim's Homepage]