Wednesday, May 18, 2011

Comments in C and C++

In C

valid comments are when text are in between /*  .......*/
It can also be used across multiple lines.But it will not support nested comments.

/*  comments  */

/*   First line
Second line  */

It can also be used like:
/*  comments
*   comments
*  comments

 new C compilers also supports inline comments    // .  but old compilers may give syntax error.
int c;  // for intializing

 C++  supports both type of comments inline comments // and /*  ...*/

No comments:

Post a Comment