Practical Programming in C

 

Lecture Notes

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.

LEC #

TOPICS

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)

 

Labs

This section contains the labs and final project.

Lab Assignments

LAB #

LABS

SOLUTIONS

Lab 1: Game of life

(PDF)

(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

(PDF)

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

 

Final Project

Final project description (PDF)

 

Assignments

ASSN #

TOPICS

ASSIGNMENTS

SOLUTIONS

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

(PDF)

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

(PDF)

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

(PDF)

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

(PDF)

6b

Function pointers, hash table

(PDF)

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

(PDF)

7

Using and creating libraries, B-trees and priority queues

(PDF)

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

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