How To Create Header File in C, C++

Header files are also called library of C, C++, which include definition of C, C++ built in functions. To create a header file in C, C++, we are using TURBOC as editor. First we need to create a file including macro or function and save it with .h extension in include folder of TC, (eg: c:/tc/bin/head.h).

code : head.h

void fun()
{
cout<<“Best Programming Institute in delhi”;
}

and after that we can include header file in our program,

code : file.cpp

#include<iostream.h>
#include<head.h>
void main()
{
cout<<“we are learning how to make header file in c++ \n”;
fun();
}

Thank you
Team VSIT
http://www.vsit.in

Share with your Friends...
4 comments

to define a macros in c, c++ we are using #define preprocessor. The advantage of a macro is that the it can replace repeated statement.

for example :

define SQR(x) x*x

now we can call SQR(x) macro anywhere in our program

Leave a Comment

Your email address will not be published. Required fields are marked *

The NuCaptcha API requires the PHP mcrypt module.