Course Overview
Small programs for a neighborhood repair workshop
First, find out what a program is and what happens between writing a source file and running it. We compare compiled and interpreted workflows before asking you to write much C. Then you will make signs for the repair desk, keep stock counts, check pickup codes, and record repairs. Each section gives you a small runnable example before asking you to try a different job yourself. A quiz closes the section.
The course draws on Stephen G. Kochan's Programming in C, fourth edition. Chapter 1 informs the opening section; Chapters 2–7 build the C basics; Chapters 8–10 lead into structures, strings, and pointers. Later sections draw on Chapters 11–13 and selected topics from Chapters 15–16: bitwise operations, the preprocessor, named types, input/output, unions, and allocated storage. The prose, programs, tasks, and diagrams are original. We put decisions before loops so you can read a condition before writing one, and give pointers their own section rather than burying them at the end of arrays.
On a machine with GCC, compile a complete example with gcc -std=c11 -Wall -Wextra main.c -o main, then run ./main. The site's C runner may also be available. Some input and file operations require a local terminal; the relevant lessons say so. Output checks can confirm what a program printed, but not every possible path it might take. Try the suggested alternate values, especially around branch boundaries and pointer validity.
Diagrams show parts you cannot see by looking at output alone: how source becomes an executable, which array slot an index selects, what occupies a string's final byte, and how two pointer expressions reach one object. Trace the diagram against its code before running the example.
Syllabus
- Demo: Declare and initialize variables
- Exercise: Declare and initialize variables
- Demo: Assign a new value
- Exercise: Assign a new value
- Demo: Choose int, double, and char
- Exercise: Choose int, double, and char
- Demo: Keep local names and constants clear
- Exercise: Keep local names and constants clear
- ✦Module Quiz
- Demo: Match printf placeholders and arguments
- Exercise: Match printf placeholders and arguments
- Demo: Build lines with escapes and multiple calls
- Exercise: Build lines with escapes and multiple calls
- Demo: Print percent signs and aligned values
- Exercise: Print percent signs and aligned values
- Demo: Evaluate expressions before printing
- Exercise: Evaluate expressions before printing
- ✦Module Quiz
- Print a Formatted Label
- Exercise: Print a Formatted Label
- Print Characters with putchar
- Exercise: Print Characters with putchar
- Format into a Bounded Buffer
- Exercise: Format into a Bounded Buffer
- Write a Line to stdout with fputs
- Exercise: Write a Line to stdout with fputs
- Input and Diagnostics in a Local Terminal
- ✦Module Quiz