comments writing in sourcecode

Jun 18, 2008 at 4:01pm
Dear Sir,
I am new to c++. I want to know about writng of comments in source code . It has been told that // method of writing requires writing of comment in one line only and it need not be closed in contrast to /* method of writing comments.If by mistake the comment goes beyond one line in // method of commenting.What will happen.
Regards,
SK Arora
Jun 18, 2008 at 6:34pm
If your comment goes beyond 1 line with a // comment, the next line will be considered a piece of code by the compiler and your project will not compile.

You'd need to do
1
2
// line 1 of comment
// line 2 of comment 
Jun 23, 2008 at 4:11pm
Dear Sir,
Thanks for the reply which has cleared my doubt.
regards
arora sk
Jun 23, 2008 at 6:34pm
If you use and ide your code will be colorcoded.
This will give you a great understanding of what's considered code and comment.
Topic archived. No new replies allowed.