learn code, properly
Learn C — so you shape systems, not just prompt them.
AI can write code. C teaches you memory, pointers, and how software really runs — so you can review, debug, and build from the metal up.
Named after the getc() function — learning C one character at a time.
Start here
Before you write C
Why fundamentals matter, then Terminal, then a Mac that can compile.
Why learn the basics of coding?
AI and copy-paste can ship a demo. Fundamentals are what let you debug it, change it, and invent the program you actually meant.
K&R · Second edition
Exercises from The C Programming Language
These are the Chapter 1 exercises from Brian W. Kernighan and Dennis M. Ritchie's textbook — Second Edition, ANSI C. We work through them one at a time.
Exercise 1-1
Hello, world
K&R Exercise 1-1: write hello, world, compile it, then break pieces off and read what the compiler says.
$ open lesson →Exercise 1-2
Unknown escape sequences
K&R Exercise 1-2: put a fake escape like \c inside printf, compile it, and read the warning — then run the program and see what printed.
$ open lesson →Exercise 1-3
Fahrenheit to Celsius table
K&R Exercise 1-3: print a Fahrenheit–Celsius table from 0 to 300, then add a heading so the columns have names.
$ open lesson →Exercise 1-4
Celsius to Fahrenheit table
K&R Exercise 1-4: invert the temperature table — Celsius on the left, Fahrenheit on the right — using the same loop with the formula flipped.
$ open lesson →Exercise 1-5
Reverse temperature table
K&R Exercise 1-5: reprint the Fahrenheit–Celsius table from 300 down to 0, using a for loop that counts backwards.
$ open lesson →Exercise 1-6
getchar() and EOF
K&R Exercise 1-6: prove that getchar() != EOF is only 0 or 1 — type a character for 1, send end-of-file for 0.
$ open lesson →Exercise 1-7
The value of EOF
K&R Exercise 1-7: print the numeric value of EOF — a one-line program that asks stdio.h what that macro actually is.
$ open lesson →Exercise 1-8
Count blanks, tabs, and newlines
K&R Exercise 1-8: read input with getchar until EOF and count spaces, tabs, and newlines as three separate totals.
$ open lesson →Exercise 1-9
Collapse runs of blanks
K&R Exercise 1-9: copy input to output, replacing each run of one or more blanks with a single blank.
$ open lesson →Exercise 1-10
Make escapes visible
K&R Exercise 1-10: copy input to output, replacing each tab, backspace, and backslash with a visible escape sequence.
$ open lesson →Exercise 1-11
Test the word count program
K&R Exercise 1-11: compile the word-count program, then try empty input, whitespace-only files, missing newlines, and punctuation to see which cases uncover bugs.
$ open lesson →