What is Header File in C language?

What is Header Files in 'C' Language?






  • Header Files are nothing but a file which consist of one or more function declarations and function definition inside it.
  • These functions inside Header file has their own purpose or task to perform; which is very useful for every programmer if they wanted to use them inside their program. 
  • To avoid repetitive coding of function header files are get used. 
  • Programmer write required functions once and store them inside meaningful header file and use required function whenever they wanted to just by adding header file in their program.
  • This way they don't have to write same code again and again they will just call/ use those functions without writing them again.
  • Every header file get saved with '.h' Extension.
  • To include Header file inside our C program we have to use # include preprocessor directive before adding file.
  • Example:- #include <stdio.h>
  • There are two types of header file: 
1.     User define Header file
2.     Built-in Header File.
  • User define Header file get added by "" double quotes.
    • Example:- #include "john.h"
  • Built in Header file get added inside < > symbols.
    • Example:- #include<stdio.h>
  • There are many header files for example:- stdio.h, conio.h, math.h etc.
  • Stdio.h header file consist functions which are useful for standard input output; It contains functions like printf(), scnaf() and so on.
  • Conio.h file consist functions required for console input output; It includes functions like getch(), clrscr() and so on.
  • Math.h file contains various maths function required for mathematical operations. Few functions are fmod(), sin(), cos() etc.
  • You can also refer to my C Language Tutorial video Series on Youtube by clicking on link given below:


Comments

Popular Posts