Header files almost always have a .h extension. The purpose of a header file is to hold declarations for other files to use. Its not easy to explain it all here, so I have attached a very good tutorial on how to go about creating your header file.
As Philip mentioned, what makes it a 'header file' is the '.h' extension. Additionally, the tutorial snippet he cited is one of the more concise explanations for 'why' we write 'header' files for our programs (e.g., function prototypes). Thank you for that link, Philip.
@Erandal Nelson not necessary, it can be .hpp or anything else... (but convention says its either .h or .hpp (legacy form c language). I have seen .cc, .cpp, .cxx, or .C. The extension of the header file doesn't matter because it is just inserted into the source file by the preprocessor, and its not compled ...
Its basic purpose is to hold all function prototypes (in case of procedural or functional programming) or classes declarations in case of oop...
One great thing about header files, is that u can share it with clients, so they can easily use uor libs or classes (u gave them only header files, and their implementation is compiled ...)