Possible Duplicate:
What are the point of header files in C?
I am working on a unix project. After searching a lot , many suggest use of header files as they are used to write code that need to be shared between several source files.
It is best to centralise the definitions in one file - Header File.
Now I got two doubts:
1) What is the significance of using header file over simply .c files.
As from this answer I get that header files are not compiled to object files. Then What happen(actually how gcc treats them)? What is the benefit? What the answer I shared want to point?
2) What are the rules or convention to write a header files. I only know this:
Header files usually ONLY contain definitions of data types, function prototypes and C preprocessor commands.
Can we write only this i.e is this is a rule or convention?
Can anyone tell me any source to learn how to write header files.
I am able to find only this -Writing Larger Programs-which does not contain much. Or any other tip or style for writing better and optimized header files.