Lesson 5: A Constructive Construction
Outline:
- C Structs
- overview
- example:
struct.c - memory layout
- Mixing structs and arrays
- example:
struct_array.c - memory layout
- example:
- Lab 2: Strings in C
Want additional practice?
Check out the interactive exercises from the textbook:
Note that some of these exercises use malloc – we’ll see that soon!
Reading assignment (to be completed by the next class):
What we talked about today:
- DiS Sec. 2.7: Structs
- DiS Sec. 1.5.1: Introduction to Arrays
- DiS Sec. 1.5.4: Introduction to Strings and the C String Library
For next time:
- DiS Sec. 2.1: Parts of Program Memory and Scope
- DiS Sec. 2.2: C Pointer Variables
- Binky Pointer Fun Video C (video by Nick Parlante)
- Pointer basics (Stanford)
- Take a look at The 5-Minute Guide to C Pointers by Dennis Kubes. If you don’t read this now, return to it in a few days. Some of it won’t make sense until later this term, but it’s still valuable.