+ 1

If we can use "/*,*/" for multi line comments, what's the use of "nesting" one comment within another?

Question on "nesting" comments within another comment

20th Dec 2016, 3:51 AM
David Retana
David Retana - avatar
2 ответов
+ 9
Sometimes multi-line comments are used to turn code into comments, so it stays in the file but won't run. That commented-out code may contain other comments. It's not really that the comments are nested, it's that everything inside /* */ or after // is a comment, even extra comment symbols. Ex: /* cout << factorial(6) << endl; //Prints the result of 6! */
20th Dec 2016, 4:19 AM
Tamra
Tamra - avatar
+ 1
the // comment can be very useful when you are coding, because your are just writing two slashes before the line you want to keep and not execute, it is more quick than to do a /* */ and most when they are unique separate lines in your code
20th Dec 2016, 3:54 AM
Amine M. Boulouma
Amine M. Boulouma - avatar