CSC 357 Lab 3
Details of C Arrays, Pointers, and Structs; UNIX Make
The format for each of the four explanations for lines 68-73 is the following:
Line X: The program fails to [compile or execute properly] because ... .
The format for each of the nine explanations for lines 92-110 is the following:
Line X: The program outputs ... because ... .
Task 1 does not have a specific deliverable for this lab (you will turn in a
Makefile for programming assignment 2). Submit your work for Task 2 on paper,
at the beginning of lab Wednesday 25 April.
10 points for each question -- thirteen explanations in total.
Collaboration with a lab partner IS allowed on all aspects of this assignment,
but everyone must submit their own paper deliverable (and not a photo copy of
your lab partner's paper).
Again, submit your work on paper, at the beginning of lab, Wednesday 25 April.
The following two makefile examples are simplified versions of the
Makefile provided for the linked list example of Lab 2. The comments
explain what's going on in each file. We'll discuss further in lab.
A very simple compile-only linked-list Makefile:
# # This is a simple Makefile that compiles the C source files for the linked # list example. This Makefile does compile the Java code, or run the program # tests. # # This Makefile is also not as efficient as the full-blown Makefile, since it # does not take advantage of make's "smart" recompilation feature, that only # recompiles a .c file if the source for the file is newer than the last time # it was compiled. # CFILES = linked-list.c list-node.c linked-list-test.c compile: gcc -Wall -ansi $(CFILES) -o linked-list-test clean: rm linked-list-test"Smarter" linked-list Makefile:
# # This is a simple Makefile that takes advantage of make's "smart" # recompilation feature, by having the compilation depend on the .o files # instead of .c files. Using this feature of make, a .c file is only # recompiled if it is newer than it's corresponding .o file. # OBJS = linked-list.o list-node.o linked-list-test.o linked-list-test: $(OBJS) gcc -Wall -ansi $(OBJS) -o linked-list-test clean: rm linked-list-test *.o