-
Header files
Hi,
I've done some searching on this site on header files but haven't got much luck...
I was wondering how exactly header files work...
Say for example, I want to create a simple header file to include with my code, what kind of coding do I need in the .h file...
All i know is the command #include "myheader.h"..
Can someone give me some more information on header files?
-
a header file can have variables, functions, classes, structs, includes, and stuff like that. for example, here is an sample main file:
Code:
#include "myHeader.h"
int main(){
func();
cout << i;
retun 0;
}
ok, heres the header:
Code:
#include <iostream.h>
void func();
int i;
void func(){
i = 15;
return;
}
of course you can take out any part of this so you can have:
Code:
void func();
int i;
void func(){
i = 15;
return;
}
but youd have to include iostream.h somewhere.
-
Ah...ok, ... thanks for the reply :)