Source code header comments : Comments « Language « C Tutorial






  1. At the beginning of the program is a comment block.
  2. The comment block contains information about the program.
  3. Boxing the comments makes them stand out.

The some of the sections as follows should be included.

  1. Heading.
  2. Author.
  3. Purpose.
  4. Usage.
  5. References.
  6. File formats. A short description of the formats which will be used in the program.
  7. Restrictions.
  8. Revision history.
  9. Error handling.
  10. Notes. Include special comments or other information that has not already been covered.
/********************************************************           
    * hello -- program to print out "Hello World".         *   
    *                                                      *   
    * Author:  FirstName, LastName                         *   
    *                                                      *   
    * Purpose:  Demonstration of a simple program.         *   
    *                                                      *   
    * Usage:                                               *   
    *      Runs the program and the message appears.       *   
    ********************************************************/  

    #include <stdio.h> 
    int main() 
    {  

        /* Tell the world hello */ 
        printf("Hello World\n");   
        return (0);
    }
Hello World








1.15.Comments
1.15.1.Adding Comments
1.15.2.Using Comments to Disable
1.15.3.The comments are enclosed in '/*...*/'
1.15.4.The '//' is used as single line comment
1.15.5.Source code header comments