Heads Files in C

C language has numerous libraries that include predefined functions to make programming easier. 
In C language, header files contain the set of predefined standard library functions. Your request to use a header file in your program by including it with the C preprocessing directive “#include”. All the header file have a ‘.h’ an extension. By including a header file, we can use its contents in our program.
C++ also offers its users a variety of functions, one of which is included in header files. In C++, all the header files may or may not end with the “.h” extension but in C, all the header files must necessarily end with the “.h” extension.
A header file contains:
Function definitions
Data type definitions
Macros
It offers the above features by importing them into the program with the help of a preprocessor directive “#include”. These preprocessor directives are used for instructing compiler that these files need to be processed before compilation.
In C program should necessarily contain the header file which stands for standard input and output used to take input with the help of scanf() and printf() function respectively.
In C++ program has the header file which stands for input and output stream used to take input with the help of “cin” and “cout” respectively.
There are of 2 types of header file:
Pre-existing header files: Files which are already available in C/C++ compiler we just need to import them.
User-defined header files: These files are defined by the user and can be imported using “#include”.
Syntax:
#include <filename.h>
or
#include "filename.h"
We can include header files in our program by using one of the above two syntax whether it is pre-defined or user-defined header file. The “#include” preprocessor is responsible for directing the compiler that the header file needs to be processed before compilation and includes all the necessary data type and function definitions.
Note: We can’t include the same header file twice in any program.
Create your own Header File:
Instead of writing a large and complex code, we can create your own header files and include them in our program to use it whenever we want. It enhances code functionality and readability.

Posted on by