wrote:
> 1) what do header files contain exactly?
> Do they just contain the variable declarations, typedefs and
> function prototypes?
They contain anything that you deem necessary to share between compilation
units. Headers are usually created to be included in more than one module
to be compiled.
> 2) taking the example of iostream.h:
BTW, there is no such header. I will assume we're talking <iostream>.
Also, you should know that _standard_ headers are not necessarily files.
Just so we're clear on that.
> it contains the prototyoes of
> various functions. which file has the actual code of these functions?
That's specific to the implementation. If the compiler vendor supplied
you with the source code to their implementation of the Standard library,
then the actual code is there somewhere. If the vendor didn't provide
the source code, then the actual code is on the vendor's computers and
you only get to see the declarations.
> 3) If I build my own header file (header.h) which includes some
> function prototypes and I have another file (program.c) that has the
> actual code for these functions, when I go to use those in another
> program. If i #include "myheader.h" in my new file (project.c) will it
> then know to look in code.c for the function?
No, it won't. You will need to compile 'code.c' separately and add it to
the command line of the linker so that the object code is linked into the
final program.
> 4) Could someone please guide me to a good link from where I can read
> about the usage of header files/
www.google.com
V