Header files plays a very important role in programming no matters what ever the programming language is.
The Basic concept behind header file is to compact and optimize the program . Header file includes all the functions which are copied to program at back end and those are executed at compile time.
Need of Header File:-
The main focus of Header file is to make program compact and to relate more than one file to reach at final desired result.
Let us understand with a real-life example
Suppose we want a cup of coffee
A cup, sugar, coffee, milk is required to make a cup of coffee. These are the basic minimum requirements to do the same.
In this we will always be in favor of ready-made cup, sugar, coffee, milk. Let us think if we have to create the same by our self then what will happen.
Possibly, generation of the same will take a long time and it will be not a good deal for us.
But what we actually prefer are ready-made things
Like Cup , Sugar, Coffee, Milk are already manufactured by various techniques in various factories.
All what we have to do is that we have to include these things which acts as header files in programming and in that ready-made things are provided which makes our procedure for generation of a product i.e. program compact and optimized.
Thats why as when we have to do programming we prefer ready-made predefined functions defined in header files. And we can use them by just including them
Extension type:- extension of all header files in C will be in .H format stand for Header file.