Header file
A header file is a source file containing declarations, macros, or other shared interface information intended for inclusion in other source files during compilation.
Modern C, Third Edition
A header file is a source file containing declarations, macro definitions, and related information intended to be included by other source files.
- How it is used
- Organizes C library and project interfaces so source files can obtain declarations and related definitions through inclusion.
- How deep it goes
- Defines declarations, scope, and interface separation, but defers detailed header implementation mechanics.
- Examples
- Uses standard-header tables, printf and typedef declarations, EXIT_SUCCESS, terminal documentation commands, and custom-interface organization.
- What you can do after
- Apply it via standard and project headers to expose declarations while keeping interface documentation separate from implementation.
Modern C
A header file is a source file containing declarations and other material intended for inclusion before compilation.
- How it is used
- Bundles declarations into interfaces that can be included before compiling C source files.
- How deep it goes
- Explains declarations, interface grouping, dependencies, and include guards, but defers detailed library semantics to platform documentation.
- Examples
- Uses stdio.h, stdlib.h, printf, standard-library headers, and a guarded project header named brian.h.
- What you can do after
- Build interfaces from scratch by grouping related declarations, dependencies, documentation, and include guards in a project header.
Also covered in
- Learn C++ by Example
- Grokking GPU ProgrammingIn early access (MEAP)
What to know first
- macroA macro is a named, reusable construct that expands into generated code or a sequence of commands when invoked, often during preprocessing, compilation, or application execution.
- size_tsize_t is an unsigned integer type in C and C++ used to represent object sizes and related counts.
Related concepts
- inline functionconfigured by · An inline function is a function defined or designated for incorporation at its use site, either syntactically or through compiler substitution, rather than necessarily invoked through an ordinary call.
- C standard libraryused by · The C standard library is the collection of functions, types, macros, and headers specified by the C language standard for use by C programs.
Questions about header file
What is header file?
A header file is a source file containing declarations, macros, or other shared interface information intended for inclusion in other source files during compilation.
Which Manning books explain header file?
Modern C, Third Edition and Modern C.
What should I know before learning header file?
Manning books that teach header file usually introduce macro and size_t first.
What is header file a kind of?
Header file is a kind of source file. A source file is a file containing program text written in a programming language for processing by tools such as compilers or interpreters.
What is header file part of?
Header file is part of include. An include directory is a filesystem directory containing header files needed by software compilation.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

