Compiling Programs with Two or More Functions
The simplest approach to using several functions is to place them in the same file. Then just compile that file as you would a single-function file. Other approaches are more system dependent, as the next few sections illustrate.
This assumes the UNIX system has the standard UNIX C compiler cc installed. Suppose that file1.c and file2.c are two files containing C functions. Then the following command will compile both files and produce an executable file called a.out:
cc file1.c file2.c
In addition, two object files called file1.o and file2.o are produced. If you later change file1.c but not file2.c, you can compile the first and combine it with the object code version of the second file by ...