Header File Inclusion

View


Dennis Ritchie created C language in 1972 at AT&T Bell Labs, USA. At the time of creating
C language, he knew that programmers who will create programs in C would require many common functions to develop programmes easily. To make the work of programmers easy, Dennis Ritchie developed many functions and stored them in various library files and their declarations in various header files.

Example of Header Files-

  1. stdio.h – having declaration of functions such as- printf( ), scanf ( ) etc.
  2. conio.h – having declaration of functions such as- getch ( ), clrscr ( ) etc.
  3. math.h – having declaration of functions such as- pow ( ), sqrt ( ) etc.
  4. string.h – having declaration of functions such as- strlen ( ), strupr ( ) etc.

To use any pre-defined functions (means functions developed by Dennis Ritchie) in our program, then we must include corresponding header file in our program.

There are 2 ways to include any header file in our program-

1. #include < Header File Name >
If we include header file by using this method then the compiler will search for header
file in the specified directory i.e. C:\ TURBOC3\INCLUDE\
Example-
#include<stdio.h>
#include<conio.h>

2. #include “Header File Name“
If we include header file by using this method then the compiler will search for header
file in the specified directory
i.e. C:\ TURBOC3\INCLUDE\
as well as in the current directory
i.e. C:\ TURBOC3\BIN\
Example-
#include”stdio.h”
#include”conio.h”

Last modified: Tuesday, 21 September 2021, 9:37 AM