A header file is a C source file that bundles interface descriptions for related features, mostly functions. It commonly contains declarations, macro definitions, and related information intended for inclusion by other source files. section 8.1.1 section 2.2
Declarations supplied through a header
A header may contain declarations and definitions such as: int printf(char const format[static 1], ...); typedef unsigned long size_t; #define EXIT_SUCCESS 0 A program includes the appropriate header so the compiler can obtain information about identifiers such as printf, size_t, and EXIT_SUCCESS. These declarations describe features; they do not create the features themselves. section 2.2 section 2.2
Use header files to organize and consume C interfaces:
- Include standard headers to access library interfaces such as input/output, character classification, mathematical functions, and error codes. section 8.1.1 section 8.9
- Create project-specific headers to collect interfaces that other source files use. section 8.1.1
- Separate interface from implementation: headers usually end in .h, while implementation resides in .c translation units. section 10.0
- Document the interface in the header and explain implementation details elsewhere. section 10.0
- Keep repeated declarations consistent; contradictory declarations in the same scope are generally not allowed. section 2.2
Table 8.1 C library headers
| Name | Description | Section |
<assert.h> |
Asserting runtime conditions | 8.8 |
<complex.h> |
Complex numbers | 5.7.8 |
<ctype.h> |
Character classification and conversion | 8.5 |
<errno.h> |
Error codes | 8.1.3 |
<fenv.h> |
Floating-point environment | 15.1.4 |
<float.h> |
Properties of floating-point types | 5.7 |
<inttypes.h> |
Formatting conversion of integer types | 5.7.6 |
<iso646.h> |
Alternative spellings for operators | 4.2 |
<limits.h> |
Properties of integer types | 5.1.3 |
<locale.h> |
Internationalization | 8.7 |
<math.h> |
Type-specific numerical functions | 8.3 |
<setjmp.h> |
Non-local jumps | 19.5 |
<signal.h> |
Signal-handling functions | 19.6 |
<stdalign.h> |
Alignment of objects | 12.7 |
<stdarg.h> |
Functions with varying numbers of arguments | 17.4.2 |
<stdatomic.h> |
Atomic operations | 19.6 |
<stdbit.h> |
Bit operations | 5.7.2 |
<stdbool.h> |
Booleans | 3.1 |
<stdckdint.h> |
Checked integer arithmetic | 8.2 |
<stddef.h> |
Basic types and macros | 5.2 |
<stdint.h> |
Exact-width integer types | 5.7.6 |
<stdio.h> |
Input and output | 8.4 |
<stdlib.h> |
Basic functions | 2 |
<stdnoreturn.h> |
Non-returning functions | 7 |
<string.h> |
String handling | 8.5 |
<tgmath.h> |
Type-generic numerical functions | 8.3 |
<threads.h> |
Threads and control structures | 20 |
<time.h> |
Handling time | 8.6 |
<uchar.h> |
Unicode characters | 14.3 |
<wchar.h> |
Wide strings | 14.3 |
<wctype.h> |
Wide character classification and conversion | 14.3 |
Browse the standard-header table to match library capabilities with their headers, including assertions, types, locales, atomics, and numerical functions. section 8.1.1

