Comment

    1100431 VIEW 1 0
  • Comment about the program should be enclosed within /* */.
  • Any number of comments can be written at any place in the program. For example, a comment can be written before the statement, after the statement or within the statement as shown below:

/* formula */ si = p * n * r / 100 ;

si = p * n * r / 100 ;

/* formula */

si = p * n * r / /* formula */ 100 ;

  • The normal language rules do not apply to text written within /* .. */. Thus we can type this text in small case, capital or a combination. This is because the comments are solely given for the understanding of the programmer or the fellow programmers and are completely ignored by the compiler
  • Comments cannot be nested.

For example,

/* Cal of SI /* Author sam date 01/01/2002 */ */ is invalid.

  •   A comment can be split over more than one line, as in,

/* This is a

jazzy

comment */

 

Notes: Often programmers seem to ignore writing of comments. But when a team is building big software well commented code is almost essential for other team members to understand it.