2.6. Header Files

Keeping track of function declarations can get messy, for this reason Header files are used to house C code that you wish to appear in multiple files. You have actually already used a header file. stdio.h is a header file which contains many function declarations, it contains the function declarations for printf() and printf(). Once you have placed the function declarations you wish to share into a header file you can #include your header in each C file that needs the information. The only difference being that you surround your filename in quotes instead of angle brackets ("my_header.h" instead of <system_header.h>). To illustrate these points we'll write that pizza program I mentioned earlier.