Connect to

facebook google Email you tube you tube you tube
Theme images by MichaelJay. Powered by Blogger.

Projects

5.3.17

How to Create Your Custom Header File in C++

What are Header files in C

 or C++?

Basically Header Files are a type of preprocessor directives used for file inclusion.

The Syntax Looks like this:
 #include<filename>
eg: #include<iostream.h>
has the following things defined: cin, cout etc.

So What if you want to make your own header file and use functions defined it to make your coding easy without duplicate codes in the syntax.
 For example if you are making a project and want to use the swap function again and again so without including the syntax of swap function you can create your own header file which contains the swap syntax and use it anywhere you want anytime, only by including that custom header file which you made.
Here is a video Tutorial of it

Steps

Step 1.You need to type the syntax of your function and also include the header files                       required for the various features you are using like for cin and cout you ll need                   iostream.h.

Step 2Change the default directory by clinking on 'FILE' drop down and click on '                       change dir'.

Step 3Select the directory turboc>include

Step 4.The click on 'ok'

Step 5Then save your file by the desired name for your header file by the extension .h.                 For eg: test.h

Step 6.Then change back the default directory to turboc>bin

    Now you have successfully Created your own header file. You can use it the way it is shown in the video.

    NOTE: Extension for your header file should always be .h.


    1 comment:
    Write comments

    Interested in our works and services?
    Get more of our update !