Practical Programming in C



This course provides a thorough introduction to the C programming language, the workhorse of the UNIX operating system and lingua franca of embedded processors and micro-controllers. The first two weeks will cover basic syntax and grammar, and expose students to practical programming techniques. The remaining lectures will focus on more advanced concepts, such as dynamic memory allocation, concurrency and synchronization, UNIX signals and process control, library development and usage. Daily programming assignments and weekly laboratory exercises are required. Knowledge of C is highly marketable for summer internships, UROPs, and full-time positions in software and embedded systems development.

Download Course Materials

The actual size of these slides is 12.8 cm by 9.6 cm. Use Adobe Reader's print options to scale the slide to fit the page before printing.

Lecture notes

1 Introduction. Writing, compiling, and debugging C programs. Hello world. (PDF)
2 Variables and datatypes, operators. (PDF)
3 Control flow. Functions and modular programming. Variable scope. Static and global variables. (PDF)
4 More control flow. Input and output. (PDF)
5 Pointers and memory addressing. Arrays and pointer arithmetic. Strings. Searching and sorting algorithms. (PDF)
6 User-defined datatypes, structs, unions, bitfields. Memory allocation. Linked lists, binary trees. (PDF)
7 Pointers to pointers, pointer and string arrays, multidimensional arrays. Stacks and queues. (PDF)
8 Void and function pointers. Hash tables. (PDF)
9 External libraries. B-trees, priority queues. (PDF)
10 C standard library: stdio.h, ctype.h, stdlib.h, assert.h, stdarg.h, time.h (PDF)
11 Dynamic memory allocation, malloc and valgrind, garbage collection. (PDF)
12 Multithreading and concurrency. (PDF)
13 Multithreaded programming. Sockets and asynchronous I/O. (PDF)
14 Linux inter process communication. (PDF)


This section contains the labs and final project.

Lab Assignments

Lab 1: Game of life


(ZIP) (This ZIP file contains: 3 .txt files, 3 .c files and 1 .h file.)

(ZIP) (This ZIP file contains: 1 .txt file, 1 .h file and 4 .c files.)
Lab 2: Data compression


(ZIP) (This ZIP file contains: 4 .txt files and 2 .c files.)


Final Project

Final project description (PDF)


1 Writing, compiling, and debugging programs; preprocessor macros; C file structure; variables; functions and problem statements; returning from functions (PDF) (PDF)
2 Types, operators, expressions (PDF) (PDF)
3 Control flow, functions, variable scope, static and global variables, I/O: printf and scanf, file I/O, character arrays, error handling, labels and goto


(ZIP) (This ZIP file contains: 1 .txt file and 2 .c files.)

4 Pointers, arrays, strings, searching and sorting algorithms (PDF) (PDF)
5 Linked lists, trees (PDF) (PDF)
6a Pointers to pointers, multidimensional arrays, stacks and queues


(ZIP) (This ZIP file contains: 1 .txt file and 2 .c files.)

6b Function pointers, hash table


(ZIP) (This ZIP file contains: 1 .txt file and 2 .c files.)

7 Using and creating libraries, B-trees and priority queues


(ZIP) (This ZIP file contains: 2 .c files and 1 .db file.)

(ZIP) (This ZIP file contains: 5 .txt files and 5 .c files.)