Consider the idea of dividing programs into more than one file. By that we
mean putting the various functions that make up the program into more than one
file.
Try to think of some reasons why this might be a good idea.
Click here for some possible answers
Let's take a look at a program divided into more than one file.
Connect to the ``separate2'' directory of your ``examples'' directory,
and then list it. You should see the files ``main.c,'' ``help.c,''
and ``help.h.'' Display the two ``.c'' files in Emacs or view them
directly as ``main.c'' and
``help.c''.
Notice that ``main.c'' makes use of the two functions defined in
``help.c''.
Is there any way that you can compile this program from Emacs? Try compiling
``main.c'' this way. What happens?
Click here for the answer
Now try compiling the buffer containing ``help.c''. What happens?
Click here for the answer
Hamlet Project
hamlet@cs.utah.edu