C Programming

Introduction

Introduction
Introduction to C
Versions of C
The C Programming Process
Using this CD

A Basic C Program

The Hello World Program
Variables
The scanf Function
Chapter 2 Exercises
Chapter 2 Solutions

Basic Elements of a C Program

Whitespace
Data Types
Strings
Arithmetic Operators
Comments
More on printf and scanf
Chapter 3 Exercises
Chapter 3 Solutions

Conditional Code

The if Statement
Blocks
The if...else Statement
The switch Statement
Relational Operators
Boolean Expressions
Advanced Relational Operators
The goto Statement
Chapter 4 Exercises
Chapter 4 Solutions
Introducing the Course Project
Course Project Solution

Loops

About Loops
The while Loop
The for Loop
The do...while Loop
eak and continue
Special Loops
Chapter 5 Exercises
Chapter 5 Solutions

Arrays

About Arrays
Strings Revisited
Multi-dimensional arrays
Array Initialisation
Chapter 6 Exercises
Chapter 6 Solutions

Strings and Characters

String Input and Output
The ASCII Character Set
Character Functions
Chapter 7 Exercises
Chapter 7 Solutions

Advanced Operators

Assignment Operators
Increment and Decrement Operators
The ? : Operator
The sizeof Operator
Casting
Chapter 8 Exercises
Chapter 8 Solutions

The C Preprocessor

About the C Preprocessor
The #include Directive and Header Files
The #define Directive
Macros
The #ifdef and #ifndef Directives
Other C Preprocessor Directives
Chapter 9 Exercises
Chapter 9 Solutions

Functions

About Functions
Defining and Calling Functions
Global Variables
Function Parameters
Functions that Return a Value
Function Prototypes
Chapter 10 Exercises
Chapter 10 Solutions

Structures

Defining and Using a Structure
Structures and Functions
The typedef Keyword
Chapter 11 Exercises
Chapter 11 Solutions

The Compilation Process

Layout of a C File
Structure of a C Program
The Compilation Process
Chapter 12 Exercises
Chapter 12 Solutions

Basic Pointers

Introduction to Basic Pointers
Understanding Pointers
Pointer Syntax
Pointer Syntax Examples
A Common Pointer Confusion
What are Pointers for?
Coding with Pointers
Pointers as Function Parameters
Pointers to Structures
Chapter 13 Exercises
Chapter 13 Solutions

Scope

About Scope
The static Keyword
Chapter 14 Exercises
Chapter 14 Solutions

Dynamic Memory

About Dynamic Memory
Understanding Memory
The malloc Function
malloc Examples
The free function
Other Dynamic Memory Functions
Chapter 15 Exercises
Chapter 15 Solutions

The Standard C Function Liary

The main Function
void Functions
Exiting a Program
File-based Input and Output
stdio.h Revisited
Standard I/O Functions
Using Standard I/O Functions
Generating Random Numbers
References
Chapter 16 Exercises
Chapter 16 Solutions

Bitwise Operators

About Bits
The and Operators
The ~ Operator
The & and | Operators
Bit-sized Structure Fields
Chapter 17 Exercises
Chapter 17 Solutions

Advanced Pointers

The void Pointer
The NULL pointer
Pointers and Arrays
Pointer Arithmetic
Pointers to Pointers
Chapter 18 Exercises
Chapter 18 Solutions

Function Pointers

About Pointers to Functions
Understanding Pointers to Functions
Using Function Pointers
Writing Generic Code
Chapter 19 Exercises
Chapter 19 Solutions
Appendix - Linked Lists
The End