hi
Is there any use of header file apart from prevention recompilation and hiding the implementation.
hi
Is there any use of header file apart from prevention recompilation and hiding the implementation.
Your header files are not for preventing recompilation (especially since modifying a header requires all including compilation units to be recompiled), nor do they hide things - it's all the contrary, actually. They expose the interface of other compilation units or libraries so that the compiler knows what symbols are available.
Say you want to use printf. Unless it is declared in a header file, the compiler has no way to know what arguments it takes or what it returns. Same thing for global variables. This is what header files are mainly for.
http://en.wikipedia.org/wiki/Header_file
Bookmarks