0% found this document useful (0 votes)
31 views

Lab 4 Slides

it gives basics of c language struct which was taught in software development methods course in fall 2014 at uvic

Uploaded by

SaadMalik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Lab 4 Slides

it gives basics of c language struct which was taught in software development methods course in fall 2014 at uvic

Uploaded by

SaadMalik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Seng 265 Week 4

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

The connection between the two files is


llist.h. #include list.h in both c files.
Compile the files together:
Gcc llist.c testlist.c o runit

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.

For more practice check:

h(p://www.cs.princeton.edu/courses/archive/spr03/cs217/lectures/Modules.pdf

A new entry in attendance and reference html

You might also like