• Home
  • About & Contact
  • Archive
  • C Programming Examples

16 February 2012

Header files and why to include header files in c programming language

What are header files?

        Header files or Libraries (as they are commonly known as) extends the Languages's functionality..C Language supports only the most basic features that it needs.C language does not even contain functions to read from the keyboard and write to the screen. such extended functionalities are written by programmers and are placed in Header files which are reusable.Header files help you to split up your program into modules.

How to include header files in your program? (only for beginner level)

      The statement you always write in your c program at the beggining.
 yaa.. you are actully including the header files.

we use preprocessor directives or commands which starts with #.
syntax :   #include<header file name . h>

why we include header files such as stdio and conio? (conio not for linux)

Most of the C input/output functions are defined in stdio.h.It is a part of the Standard C Library
refer the header file for the list of available functions.the most commonly used are printf,scanf.

conio.h is a C header file used in MS-DOS compilers for performing "console input and output" from a program.It is not a part of the Standard C library.Compilers that target non-DOS operating systems, such as Linux,Win32 do not support this header file.

beside these, the Standard C Library contains a large number of functions for tasks like string handling, mathematical computations, input/output processing, memory allocation and several other operating system services.

If you are using turbo c++ compiler you can see the header files with the function present in that header file in help section.

Here I  am providing small list of usefull header files.

math.h   it provides many useful functions such as cos,sin...,log,mod,pow etc.
string.h  it provides many string handling functions to compare,concatenate strings,to find their length
                String functions in C with examples in detail.
malloc/calloc for allocating memories and for memory manegment functions.
stdlib.h  this header file has variety of different methods.
stddef.h contains declaration and definitions of default macros and types
bios.h It contains function for basic input /output such as biosdisk bioskey .
graphics.h This header file is useful for drawing 2d objects such as lines, rectangle,oval etc and also filling color .
process.h This header file contains functions such as spawn create and run (executes) other files,known as child process
complex.h this header file contains functions which are required for conversion to complex number from given real and imaginary part.

In short we use header files so that we can use in-built functions.
Want to create your own header files then click here

How to create your own Header File in C/C++ language

Share your views regarding the given post via the comments section given below. If you liked the post, please '+1' it & share it on other social networks.
Thank You.


  1. thanks for helping............

  2. contains good stuff

  3. thnx and more would be added soon

  4. good job cont..

  5. Anonymous06 July, 2012

    good is really helpful..keep cont

  6. Thank you
    please comment with selecting your profile rather than anonymous

  7. thxx guys thisnis helpful to me

  8. Replies
    1. C language without any header files may not even compile in most of case as for basic operations we require conio.h and stdio.h

      Header files contains the functions which we use normally like printf(),scanf(), getch().
      different header files contains different functions as explained before.As per our need we include different header files and we use the functions present in them

  9. i need a program that is written in object oriented programming in c++ draw a shape of rectangle and triangle

  10. check this out how to create your own header files :