What is a header exactly? you knwo the thing that has to be included with C++ program if you want to do some certain stuff... like ---> <iostream.h> <--- is it a c++ function? or is it a class?
Thanks.
Printable View
What is a header exactly? you knwo the thing that has to be included with C++ program if you want to do some certain stuff... like ---> <iostream.h> <--- is it a c++ function? or is it a class?
Thanks.
A header file just contains pre-written code. The header file "iostream.h" contains the "cout" function. "string.h" contains "strlen()", and so on...
:):):):):):):):):):):)
Actually, headers contain definitions, rather than actual code. You then include the header and link with the library, which contains the actual code. The header is just there for the compiler's benefit so it knows what you're doing.
You could make your own header file called mymaths.h that could include functions for adding and subtracting 2 numbers . Like:
int Add(int nNumber1, int nNumber2)
{
return nNumber1 + nNumber2;
}
Then for a console app you could put:
#include "mymaths.h"
#include "iostream.h"
void main()
{
char cPause;
int nAnswer;
nAnswer = Add(34,65);
cout << nAnswer;
cin >> cPause;
}