By Wael

Last updated :

Posted :

Comments in c

Comments in c can be written in either of these two ways :

comments in c : // /**/
/* This is a comment */
// this is a comment

In the first case the comment is enclosed by /* */ . In the second case the comment starts after the // and spans till the end of the line , not including the new line character .

/**/ and // are treated as regular characters inside a string and a character literal . /* and // do not introduce a new comment when they are written inside a comment .

Comments in c // This is a comment A comment that starts with // . /* This is another comment */ A comment enclosed within /**/ . /* /* */ /* inside /**/ is ignored and is treated as the two characters / and * . /* */ */ This will cause an error . char * aCharPtr = "/**///"; A string containing 6 characters .