Section C.9 C3: Arrays, Structs, I/O
Discuss basic array handling by means of a small example: read in numbers from the console and put them into an array and compute the average/sum/something similar.
Understand that arrays degenerate to pointer of first element in the context of R-eval.
sizeofis the size of the type and evaluated at compile time. Cannot use it to query size of container at runtime. Makes a difference for malloc'ed containers.
Start a more complex example. Read in person records from a file (name, surname, date of birth)
Discuss basic I/O
Struct become helpful. Discuss composition vs aggregation. Mention that strings are null-terminated arrays of characters.
Simplify program with respect to pointer notation; explain
Modularize program into different files, creating functions for reading and printing records.
Add command line argument for file name and explain