Re: Use of Header files

----- Original Message -----
> Hello all,
> What is the use of the header files?what happen if we don't include
> any header file?

C++ (and modern C) require that functions be declared before being used. In
small projects, you can sometimes get away with just defining your functions
(which also declares them). Stuff like

void foo()
{
}

int main()
{
foo();
}

In larger projects, you'll want to use separate compilation (i.e., break up
your code into multiple files). For instance, putting the above two into
files foo.cpp and main.cpp. But if you do that, main.cpp no longer sees the
declaration of foo. So you would need a foo.h containing a declaration of
foo, and to have both foo.cpp and main.cpp #include "foo.h"