Lab 4 Slides
Lab 4 Slides
Attendance
New reference for later
This week breaking a C program into
separate modules.
Create a header file with the shared functions
Create a separate c file with the function
bodies and local variables
Create a test file with just the main
1
Highlight
Structs
Referencing a struct member that is a
pointer use:
structname->member rather than
(*structname).member
If the member is not a pointer but a value then
the reference would be structname.member
2
This Week
Take llist.c and break it out into two
separate c files and 1 .h file:
llist.c and testlist.c
llist.h
llist.c has the list functions and local list
variables. llist.h has the type def and
function prototypes dont forget the
extern keyword for the prototypes
3
More on modules
testlist.c has the main
Do that now:
4
Complete the module
Complete the missing functions in the
llist.c module
You can use the other functions as a guide.
5
Homework
Look up structs both as records and as
type definitions.
h(p://www.cs.princeton.edu/courses/archive/spr03/cs217/lectures/Modules.pdf