What is a *.h file?
_Pol_
-
Devlopper :D -
Devlopper :D -
Hello everyone, crazy programmers... I'm writing to ask you a little question that may be simple for you, the veterans of computing, but for me, it's a real headache that I've been giving myself every evening for the last 3 days. So, here's my little, simple, easy question... :
What is a *.h file? And how can we use it?
The programming language is C++ [with Visual C++ .NET], I have an old PC [as long as it works...] : Pentium 560 Mhz, 256 Mb, 40 Gb HD... Running Windows XP Home Edition.
Thanks in advance and... have a great day =D
Your enchanting and sometimes ridiculous retreating, Paul.
What is a *.h file? And how can we use it?
The programming language is C++ [with Visual C++ .NET], I have an old PC [as long as it works...] : Pentium 560 Mhz, 256 Mb, 40 Gb HD... Running Windows XP Home Edition.
Thanks in advance and... have a great day =D
Your enchanting and sometimes ridiculous retreating, Paul.
2 réponses
Hi,
h is the short form for header.
A header file is where you usually define the prototypes of functions. It's also where you define custom types, structures, and classes.
What is it for? First, to make it easier to navigate, you can find the reference of what is in a C or CPP file in the header it includes.
But also, it allows you to signal the existence of a function so you can use it before it has been defined.
Example:
Prototype of a function called bidule:
If this truc is in the header of a C file (that is, in a *.h file included in the C file), then you can use this function even if its definition is further down in the C file or in another linked C file.
So you can find its definition elsewhere:
I have a hard time explaining, so let me know if you don't understand.
h is the short form for header.
A header file is where you usually define the prototypes of functions. It's also where you define custom types, structures, and classes.
What is it for? First, to make it easier to navigate, you can find the reference of what is in a C or CPP file in the header it includes.
But also, it allows you to signal the existence of a function so you can use it before it has been defined.
Example:
Prototype of a function called bidule:
void bidule(char *truc);
If this truc is in the header of a C file (that is, in a *.h file included in the C file), then you can use this function even if its definition is further down in the C file or in another linked C file.
So you can find its definition elsewhere:
void bidule(char *truc) { printf("%s",truc); } I have a hard time explaining, so let me know if you don't understand.
Thank you.
it is very detailed and explains everything from A to Z (but it is very long)