Source Code


This section provides links to the source code for each of the books examples. Generally these examples provide a brief description of the purpose of the program. Following the description is a line by line breakdown of the program. The breakdown is in more depth than then one in the book.

Source Code

Chapter 1

There is no source code for this chapter

Chapter 2

MyHelloWorld - Traditionally programming courses start with a program that displays the line 'Hello World' on the screen. This program breaks that tradition.

Chapter 3

BobsLife - A small example that demonstrates using the shorthand if - then operator ?:

DayCalculator - An example program to demonstrate the use of the switch statement, showing use of the break; statement, default block and drop throughs.

Functions - This example provides an introduction to functions. Showing how to define and use them. A more advanced example can be found under PostFunction.

IfBob - An example demonstrating a for loop and cascading if ... else statements. Also demonstrates the various comparison operators.

InputOutput - A small program to demonstrate using the printf and scanf input output functions. The use of format modifiers is also demonstrated.

Loopy - The use of for, while and do...while loops are demonstrated in this example.

MyStringThing - This example demonstrates the use of C style strings and some of the most common functions that operate on strings.

Pointy - The use of pointers is demonstrated in this example.

PostFunction - This somewhat minimal example complements the previous example on functions. This time the use of separate declaration and definition of functions is demonstrated.

PrePro - This example provides an introduction to the use of preprocessor statements.

SimpleC - This is our example program to the world of C programming. For those old enough to remember it takes a catch phrase from a TV series called the prisoner.

SingleFile - Demonstration of reading and writing files to and from the hard drive. Also demonstrates the use of STDIN and STDOUT.

TruncationAssignment - This example shows how values can be altered by converting between one data type and another.

UnitedStructures - The difference between structures and unions is demonstrated by this program.

VariableFunctions - An example of how to write functions that take a variable number of arguments like the printf() function does.

Variables - A small program showing how much memory is used by each of the different data types.

Chapter 4

Chapter 6

Chapter 7