title: Writing Rules or Conventions and working - Header Files in C
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2184646/what-are-the-point-of-header-files-in-c">What are the point of header files in C?</a>  </p>
  </blockquote>
  
  
  
  <p>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.  </p>
  
  <blockquote>
    <p>It is best to centralise the definitions in one file - Header File.  </p>
  </blockquote>
  
  <p>Now I got two <em>doubts</em>:<br>
  <strong>1)</strong> What is the significance of using header file over simply .c files.<br>
  As from <em><a href="https://stackoverflow.com/a/2146254/742173">this answer</a></em> I get that header files are not compiled to object files. <strong>Then What happen(actually how gcc treats them)? What is the benefit? <em>What the answer I shared want to point?</em></strong>  </p>
  
  <p><strong>2)</strong> What are the rules or convention to write a header files. I only know this:  </p>
  
  <blockquote>
    <p>Header files usually ONLY contain definitions of data types, 
    function prototypes and C preprocessor commands. </p>
  </blockquote>
  
  <p>Can we write only this i.e is this is a rule or convention?  </p>
  
  <blockquote>
    <p><strong>Can anyone tell me any source to learn how to write header files.</strong>  </p>
  </blockquote>
  
  <p>I am able to find only this -<a href="http://www.cs.cf.ac.uk/Dave/C/node35.html" rel="nofollow noreferrer">Writing Larger Programs</a>-which does not contain much. Or any other tip or style for writing better and optimized header files.</p>