|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Required and Optional Header Files
The description of each run-time routine includes a list of the required and optional include, or header (.H), files for that routine. Required header files need to be included to obtain the function declaration for the routine or a definition used by another routine called internally. Optional header files are usually included to take advantage of predefined constants, type definitions, or inline macros. The following table lists some examples of optional header file contents:
If a library routine is implemented as a macro, the macro definition may be in a header file other than the header file for the original routine. For instance, the _toupper macro is defined in the header file CTYPE.H, while the function toupper is declared in STDLIB.H.
Many library routines refer to constants that are defined in header files. For instance, the _open routine uses constants such as _O_CREAT, which is defined in the header file FCNTL.H.
Some library routines return a structure or take a structure as an argument. For example, stream input/output routines use a structure of type FILE, which is defined in STDIO.H.
The run-time library header files provide function declarations in the ANSI/ISO C standard recommended style. The compiler performs type checking on any routine reference that occurs after its associated function declaration. Function declarations are especially important for routines that return a value of some type other than int, which is the default. Routines that do not specify their appropriate return value in their declaration will be considered by the compiler to return an int, which can cause unexpected results. See Type Checking for more information.