Header file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Header file

Apparently we can define the syntax of the header file in the following ways: #include <filename.h> #include "filename.h" or #include "filename" For user-defined header files, how come we cannot use the first format? Is it because angular brackets are explicitly used for the already built-in header files?

29th Jul 2020, 6:12 AM
Solus
Solus - avatar
2 Answers
+ 2
Enclosing the header file name within angular brackets signifies that the header file is located in the standard folder of all other header files of C/C++. So the user defined header file it can be any place but the iostream or other slandered header file is in the slandered folder .So you can define it with angular bracket but not user defined header file.
29th Jul 2020, 6:27 AM
The future is now thanks to science
The future is now thanks to science - avatar
0
We use .h extension with double quotation for user-defined header to differentiate between the third party headers and the compilers native headers. Here's the order: #include "myheader.h" // User-defined Header #include <windows.h> // Third-party Header #include <iostream> // Compilers native Header
29th Jul 2020, 1:35 PM
DEATH128
DEATH128 - avatar