+ 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
2 Answers
+ 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!
*/
+ 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