PATH
Mac OS X Server Documentation >
The GNU C Preprocessor
Uses of Header Files
Header files serve two kinds of purposes:
-
System header files declare the interfaces to parts of the operating system. You include them in your program to supply the definitions you need to invoke system calls and libraries.
-
Your own header files contain declarations for interfaces between the source files of your program. Each time you have a group of related declarations and macro definitions, all or most of which are needed in several different source files, it's a good idea to create a header file for them.
Including a header file produces the same results in C compilation as copying the header file into each source file that needs it. But such copying would be time-consuming and error-prone. With a header file, the related declarations appear in only one place. If they need to be changed, they can be changed in one place, and programs that include the header file will automatically use the new version when recompiled.
By convention, names of header files end with the extension ".h".
The GNU C PreprocessorPrevious | Contents | Next