Jun 17, 2014

C Programming #17: Comments

Sometimes in C code programmer want to keep notes besides the code. C provides comments which help the programmer to do the same. Content of C comment is totally removed when compilation happens.

There are two type of comments.
  1. Multi line
  2. Single line

Multi line comment

Anything between /* and */ is a forms a multi line comment.

For Example

/* This is a comment */

/* This is multi
   line comment */

Single line comment

Anything between // till the end of line is considered as single comment.

For Example

// This is a single line comment

Real examples will be given starting from the next article. Comments are essential documentation which should convey the rationale of the code.


Quiz - Not Yet written !!
Next Article - C Programming #18: Decision Making - if, else if, else
Previous Article - C Programming #16: Operator precedence, associativity and order of evaluation
All Article - C Programming

No comments :

Post a Comment