Introduction to C Programming


Course Syllabus

The course follows K&R fairly closely. Most major headings in the Syllabus mab to chapters in K&R. The two major exceptions to this are the Data Structures segment and the Programming Style and Standards segment. The Data Structures segment was mostly taught from examples (although I personally used Tenenbaum, Langston, & Augenstein, "Data Structures Using C", 1990, Prentice Hall, and http://swww.ee.uwa.edu.au/~plsd210/ds/AVL.html, which is no longer available without a password unfortunately. The Programming Style and Standards segment was going to incorporate various web and print sources, but the class was running on for too long, so that section was cut.

Introduction
    What is C?
    Compilers, Linkers, Precompilers (make and lint)
    Basic Structure
    hello.c
    fahr.c
    printf() and fprintf()

Types, Operators and Expressions
    The Programmer's Memory Model
    Variables, Declarations and Data Types
    Constants
    Intro to Arrays, Structures and (gasp!) Pointers
    Arithmetic, Logical and Assignment Operators
    Type Conversions
    Increment, Decrement and Bitwise Operators
    Expressions
        +=, -=, ...
        ()?: syntax
    Precedence and Order of Evaluation

Control Flow
    Statements and Blocks
        include 4.8
    if...else if...else
    while, for and do
        break and continue
        for loop w/o stmts on p69
    switch
    goto and Labels (Boo!  Hiss!)

Functions and Program Structure
    Function Basics
    Procedures (= void Functions)
    External (global) Variables
    Scope Rules, Externs and Statics
        static and externs guarenteed zero
        mention register again because it appears in book here
    Multiple Module Programs
    The Preprocessor
        #define macros
            hazards
        #undef
        ## concatenation
            need good example for this
        #if, #if defined, #ifdef, #elif, #else, #endif
        __LINE__, __FILE__, __DATE__, __TIME__, __STDC__

Pointers and Arrays I
    Pointers and Addresses
    Pass by Reference - Pointers in Function Args
    Pointers, Arrays and Address Arithmetic (Review)
    The alloc familly

Data Structures
    Stacks and Queues
    Linked Lists
    Basic Binary Trees
        upside-down orientation
        root, node, subtree, parent (father), child (son), leaf
        ancestor, descendant, left child/descendant, right child/descendant
        level - root is level 0
        *Introduce Example*
        all nodes of same type, don't use pq ticks
        recursion
        tree in array (n, 2n, 2n+1)
        thread links to speed traversals
        game trees

Pointers and Arrays II
    Character Pointers and Functions - Another Look at Strings
    Pointer Arrays; Pointers to Pointers
    Multi-dimensional Arrays vs. Pointer Arrays
    argc and argv
    Pointers to Functions - Woo Hoo!
    "Complicated" Declarations

Structures
    Structures and Functions
    Arrays and Structures
    Pointers to Structures, Structures with Pointers
    Typedef (Review)
    Unions
    Bit-fields

Input and Output
    Standard Input and Output
    Variable Length Argument Lists
    File I/O
    Error Handling - stderr and exit()
        read from Plauger
    Line Input and Output
    A Brief Tour of the Standard Libraries
        string.h
        ctype.h
        ungetc()
        system()
        math.h
        random numbers

The UNIX System Interface?
    File Descriptors
    Low Level I/O - read() and write()
    open(), creat(), close() and unlink()
    lseek()
    Some Practical Examples
    The Guts of Malloc

Programming Style and Standards

Advanced Topics
    bsearch
    qsort
    Priority Queues and Simulators
    Tracking Memory Allocation
        Vesp method
        shareware libraries
    Object Oriented Programming in C
    signals
    event/interupt driven programming
        client server
        X

Course Materials

Homework Assignments:
This is an incomplete list at the moment, since it is only the assignments that I typed up and sent to the students as email. I will add in the other assignments ASAP.

Homework Solutions:
Whenever possible, if I hadn't previously written such a program I tried to do the programming assignments in advance to make sure that they where possible, not unfairly difficult, and didn't involve techniques I hadn't covered yet. These are the results. Although now that the're open for public inspection, I suppose I should go back and comment them.

Sample Code:


Back to Ian's Home Page