I wanted to ask why would some insert a single line comment inside a multi line comment? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I wanted to ask why would some insert a single line comment inside a multi line comment?

Why would a need arise to put a single line comment within multi line comment? I would be grateful if you please give me and example too.

4th Jul 2019, 12:16 PM
parth jangid
parth jangid - avatar
1 Answer
+ 5
They might've written a method and added some comments, then later decided to comment the entire method in case they might need to use the method later. This is one way to get a single line comment in a multi line comment. /*void printCars(){ //print Car 10 times. for (int i=0; i<10;i++){ std::cout<<"Cars"<<i; } }*/
4th Jul 2019, 12:29 PM
silentlearner
silentlearner - avatar