Before we get into the nitty-gritty of the differences between source files and header files, we first need to understand why we need to have multiple source files at all.
In Chapter 23, Using File Input and File Output, we saw how some of the functions in that program pertained only to opening and closing files, and some of the functions pertained only to manipulating a linked list. We used the sortNames.c file to define the usage(), getName(), putName(), trimStr(), and, of course, main() functions. Each of these functions deals with some detail of input and output. Although you could argue that trimStr() belongs more logically in a string-handling source code file, we use it here to clean up the string from getName(), so here it stays. To sort the names, we used functions declared in nameList.h and defined in nameList.c. These functions dealt only with the linked list structure. Since these functions were called from the main() functions...