|↑| ❪✺₁;❫ Classes of C Files ○ | Header File ○꠹ ⦍✺₁;⦎
⮞ 🟣 𓂃𓂃𓂃
⮞ ➔ 𓂃𓂃𓂃
⮞ ⛛ 𓂃𓂃𓂃

⤷ ・・・ ・・・ ・・・ | [[|🛈]]



Entries

၊၊||၊|။

Header File ○꠹|Definition|1st|20261019230150-00-⌔

Include directive - Wikipedia#Header_file

Header file

In C and C++, a header file is a source code file that allows programmers to share and reuse declarations of a codebase – often implemented into separated, logically related groupings.

A header file declares programming elements such as functions, classes, variables, and preprocessor macros. A header file allows the programmer to use programming elements in multiple body files based on the common declaration in the header file. Declarations in a header file allow body files to use implementations without including the implementation code directly. The header keeps the interface separate from the implementation.1

Compilation errors may occur if multiple header files include the same file. One solution is to avoid including files in header files – possibly requiring excessive include directives in body files. Another solution is to use an include guard in each header file.2

The C standard library is declared as a collection of header files. The C++ standard library is similar, but the declarations may be provided by the compiler without reading an actual file.

C standard header files are named with a.h file name extension, as in #include <stdio.h>. Typically, custom C header files have the same extension. Custom C++ header files tend to have more variety of extensions, including.hpp,.hh,.h++ and.hxx as well as the ambiguous.h.

A C++ standard library name in angle brackets (i.e. <vector>) results in declarations being included but may not be from a file.3

Printed 2026-10-19.

(echo:: @ ᯤ ᯤ)

Footnotes

  1. Alan Griffiths (2005). “Separating Interface and Implementation in C++”. ACCU. Retrieved 2013-05-07. ↩

  2. Pike, Rob (21 Feb 1989), Notes on programming in C, Cat-v document archive, retrieved 9 Dec 2011 ↩

  3. C11 standard, 7.1.2 Standard headers, p. 181, footnote 182: “A header is not necessarily a source file, nor are the < and > delimited sequences in header names necessarily valid source file names. ↩

Link to original

⤷ ・・・・・・・・・