In typical C/C++ projects, source header files frequently use which filename extension to indicate a header (choose the most common traditional extension)?

Difficulty: Easy

Correct Answer: .H

Explanation:


Introduction / Context:
Header files declare interfaces, types, and function prototypes that can be shared across multiple translation units. While modern C and C++ standard headers are often referenced using angle brackets without a file extension (for example, ), many codebases and platforms still use file extensions to distinguish headers from implementation files.


Given Data / Assumptions:

  • The question targets conventional, legacy, or platform-neutral naming practices.
  • We are not restricting to the C++ standard library naming scheme; we consider user headers as well.
  • Case sensitivity may vary by operating system; .H and .h are conceptually the same family.


Concept / Approach:
The most traditional and widely recognized extension for header files is .h (lowercase), and on some systems .H (uppercase) appears equivalently. None of the other listed extensions are standard practice for C or C++ headers. Therefore, among the provided choices, .H is the correct selection standing for the common header extension family.


Step-by-Step Solution:
Identify the typical header extension used by C and C++ projects: .h.Map to the provided options, noting that .H represents the same convention in uppercase.Exclude nonstandard endings such as .HE, .HEA, and .HEAD.Conclude that .H is the best match among the available options.


Verification / Alternative check:
Examine open source projects across platforms; user headers consistently appear as .h. On case-sensitive filesystems, .H may be a stylistic or historical alternative, but remains recognizable as a header extension compared with the nonstandard alternatives listed.


Why Other Options Are Wrong:

  • .HE, .HEA, .HEAD are not recognized extensions in conventional C or C++ build systems.
  • None of the above is incorrect because .H matches the common header extension convention.


Common Pitfalls:
Confusing modern standard headers like (no .h) with user headers. Even in modern C++, user headers often still use .h or platform variants such as .hpp for C++ specific headers.


Final Answer:
.H.

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion