what is the main use of header files?

  1. profile image45
    asit gaineposted 7 years ago

    what is the main use of header files?

  2. dabeaner profile image57
    dabeanerposted 7 years ago

    I don't know in what context you mean.  But, in constructing web pages using php, a header file is a php file that has the code for the top of the pages that you see.  There may also be footer, sidebar and other php files.  Those are then assembled by your host server, on the fly, for each visitor, along with the main php file for the page which makes the whole page different from other pages.

    Each page of the site at
    is basically constructed of a common header file, sidebar file, and footer file, along with a separate main file for each page.  So if you look at different pages on that site, you will see that the top, bottom, and side of each page looks the same, but the main parts are different.

  3. profile image47
    onetecposted 7 years ago

    Often in large projects it is desireable to separate out the subroutines (which are presumably of a more generic nature) from the main part of the program. As well, it is also often the case that one wants to reuse subroutines in different programs, and copying the code from one program to another, as well as being tedious and prone to error, makes maintainability more difficult. As with the use of modules in Perl, it is possible to separate out the subroutines from the main program into separate files.