header file

Header File: A header file is a file containing C declarations and macro definitions to be shared between several source files. Header can be the system header file or it can be created by the users.

Syntax for system Header Files:

#include <file>


#include <stdio.h>


It searches for a file named ‘stdio.h’ in a standard list of system directories

Syntax for User defined Header Files:

#include “file”


It searches for file name ‘file’ in the directory containing the current file.

Example(Actual implementation is some how different where header file only contains the declarations)

Create a header file demoheader.h, that contains add() function.

Main program in demo.c


Addition of two number is : 30


The complier will see the same token stream as it would, if demo.c read.


A header file is a file with extension .h

To use header file in the program by including it with the C preprocessing directive #include