Source: https://mokxi.com/teachers/plans/c-pointers-and-memory
Updated: 2026-11-19

Lesson plan

# Pointers and memory in C lesson plan

What is really in 2 KB of RAM, and the idea that makes C what it is: addresses, pointers, arrays and strings by hand, structs, the stack, function pointers. Ends with a serial command line built from all of it.

4 chapters, 8 lessons, about 5 hours, on the Arduino Uno R3. Every lesson runs in the browser, with nothing to install.

Start a class from this course

The unit

## Objectives and materials

### By the end, students can

- Addresses in the Uno's 2 KB, then pointers that hold them.
- Arrays as pointers, then strings walked by hand.
- Structs and the arrow, then where locals and statics live.
- Function pointers, then a command parser built from everything.

### Materials for the whole unit

- Arduino Uno R3
- Full-size breadboard
- LED x 3
- Pushbutton
- Resistor x 3

Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.

Chapter 1. About 1 h 20 min

## Where things live

Addresses in the Uno's 2 KB, then pointers that hold them.

Lesson | Time | What students do

Addresses Every variable lives at a numbered byte: where globals sit in the Uno's 2 KB, neighbors in an array, the bytes of a number stored little end first, and the map from 0x100 to 0x8FF. | 40 min

- Run it: where fuel lives
- Neighbors in an array
- Little end first
- The map of 2 KB
- Wider boxes, wider gaps
- Quick check: predict, then read

Pointers A variable that holds an address: declaring one, reading and writing through it with *, swap done right, NULL and the check before you follow it, and a button that fires at whatever the pointer aims at. | 40 min

- Run it: p holds an address
- Write through it
- Swap, done right
- Take hits
- Aim somewhere else
- NULL: pointing at nothing

### Materials

- Arduino Uno R3
- Full-size breadboard
- LED x 3
- Pushbutton
- Resistor x 3

### Check for understanding

Each student finishes "Pointers" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "NULL: pointing at nothing".

Chapter 2. About 1 h 20 min

## Arrays and text

Arrays as pointers, then strings walked by hand.

Lesson | Time | What students do

Arrays are pointers An array's name turns into the address of its first element: pointer arithmetic that counts in elements, a[i] as *(a + i), walking an array with a pointer, the sizeof trap in a function, and a lamp chaser that is a moving pointer. | 40 min

- Run it: the name is the address
- Pointer arithmetic counts elements
- Walk it with a pointer
- The sizeof trap
- Start one along
- A chaser is a moving pointer

Strings by hand A C string is chars and a zero byte: length, upper case and reverse written with pointers, a buffer overflow you can watch trample its neighbor, the bounded copy that stops it, and a compare that lights a lamp. | 40 min

- Run it: three bytes for two letters
- strlen, with pointers
- Type a callsign
- Watch an overflow
- Copy with a limit
- Compare by hand

### Materials

- Arduino Uno R3
- Full-size breadboard
- LED x 3
- Pushbutton
- Resistor x 3

### Check for understanding

Each student finishes "Strings by hand" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Compare by hand".

Chapter 3. About 1 h 10 min

## Structs and the stack

Structs and the arrow, then where locals and statics live.

Lesson | Time | What students do

Structs and pointers A fleet of ships in an array of structs: sizeof with no padding on the AVR, the arrow operator, a copy against a pointer, a search that returns NULL, a button that flies, and a fourth ship. | 40 min

- Run it: 13 bytes a ship
- The arrow
- A copy is a copy
- Find returns a pointer, or NULL
- Fly with the button
- A fourth ship

Stack and static Where things live in 2 KB: globals low, the stack high and growing down with every call, a local that forgets against a static that remembers, and a buffer that eats the free RAM. | 30 min

- Run it: low and high
- Every call goes deeper
- A counter that forgets
- static remembers
- Spend the free RAM

### Materials

- Arduino Uno R3
- Full-size breadboard
- LED x 3
- Pushbutton
- Resistor x 3

### Check for understanding

Each student finishes "Stack and static" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Spend the free RAM".

Chapter 4. About 1 h 25 min

## Code as data

Function pointers, then a command parser built from everything.

Lesson | Time | What students do

Function pointers A pointer to code: one call that runs add or multiply, a sort that takes its order as a function, a callback for each element, and a table of lamp modes, with a police mode you add yourself. | 40 min

- Run it: op(6, 7)
- A sort that takes its order
- Sort the other way
- Callbacks
- A table of modes
- Add police mode

Project: a command parser Everything in one program: a bounded line buffer, a tokenizer that splits in place into argv, a number parser, lamps found by name through a table, and a table of commands with function pointers. Add your own command, then make it yours. | 45 min

- Run it: a command line
- help reads the table
- Split in place
- Numbers from words
- Bad input, good answers
- Add your own command
- Make it yours

### Materials

- Arduino Uno R3
- Full-size breadboard
- LED x 3
- Pushbutton
- Resistor x 3

### Check for understanding

Each student finishes "Project: a command parser" on their own, without opening the hints. The simulator checks 7 of its 7 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Make it yours".

Your class

## Teach this unit as a class

Start a class from this course and its 8 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.

The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.

Start a class from this course See the demo class

More units

## Other lesson plans

Electronics basics 20 lessons, about 10 h. Embedded on the Arduino Uno 16 lessons, about 12 h. Embedded on the ESP32-C3 13 lessons, about 11 h. Embedded on the Raspberry Pi Pico 7 lessons, about 6 h. Build your own fight stick 5 lessons, about 4 h. Embedded on the STM32F411 6 lessons, about 6 h. C++ on a board 13 lessons, about 10 h. Digital logic and memory 4 lessons, about 4 h. Interactive devices on the Uno 9 lessons, about 8 h. From gates to a computer 23 lessons, about 16 h. Build a claw machine 8 lessons, about 6 h. Every unit All the courses as ready-made units, on the teachers page.
