Sunday, 5 February 2012

Header Files

Dear Visitors,
            In this post you will learn about the 'Header Files' and their uses in C program.....


SO FRIENDS LETS START OUR LESSON
  • Header Files:-
The header files contain the declarations or information of standard library functions. These functions are called in the main body of the program to perform different tasks. The extension of a header file is ".h".
                In C language, there are many header files. Each header file contains information (or declarations) for a particular group of functions. 
For Example:-
  The header file "math.h" contains declarations of mathematical functions available in C.
         A header file must be included at the beginning of the program, it its functions are to be used in the program. A program may contain many header files.
 The "include" directive is used to include the header file into the program. The name of header file is written between angle brackets < > or in double quotes.
      The general syntax to include a header file at the beginning of C program is:
#include<name of header file>
For Example:-
                           To include header file 'stdio.h' and 'conio.h' in the program the statements (preprocessor directives) are written as:-
#include<stdio.h>
#include<conio.h>
                         In most C programs, header file "stdio.h" is used. The word ''stdio" stands for standard input or output. This file contains the declarations of standard input and output functions. These functions are used to get input and to print output. Similarly, ''conio.h" header file is included to use its functions "clrscr()". The "clrscr()" function is used to clear the screen of monitor.

No comments:

Post a Comment