Which of the following is user-defined header file extension used in C++?
2023
Which of the following is user-defined header file extension used in C++?
- A.
hg
- B.
cpp
- C.
h
- D.
More than one of the above
- E.
None of the above
Attempted by 238 students.
Show answer & explanation
Correct answer: C
In C++, user-defined header files typically use the '.h' extension. This extension is standard for declaring functions, classes, and variables that are meant to be included in multiple source files. The '.hg' extension is used by the Mercurial version control system and is not related to C++ files. The '.cpp' extension is used for C++ source files, not header files. Therefore, only the '.h' extension is correct for user-defined header files in C++.