In C you are not allowed to nest comments as /* hello /* this is */ invalid */ . Is this true foe C++ also? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In C you are not allowed to nest comments as /* hello /* this is */ invalid */ . Is this true foe C++ also?

18th Jul 2018, 8:29 AM
Siddharth Kumar
Siddharth Kumar - avatar
5 Answers
+ 1
Yes as C++ is same as C only has OOP as additional concept. You can also try this in playground , it will produce error. Hope this helps ☺️☺️.
18th Jul 2018, 8:44 AM
Meet Mehta
Meet Mehta - avatar
+ 2
Its impossible to nest comment cuz when you type /* the following will be thought as comment until a */ shown up. Thus, another /* in the comment will also be thought as part of the comment. Hope u understand what i am saying.
18th Jul 2018, 8:55 AM
LAWArthur
+ 1
Yes I will be happy to help. But if you try to debbug code (attached) , will improve your debugging skill. https://code.sololearn.com/cfOF106P4w7o/?ref=app
18th Jul 2018, 8:56 AM
Meet Mehta
Meet Mehta - avatar
0
Also why dose this happen. isn't everything inside /* ... */ is ignored ?
18th Jul 2018, 8:48 AM
Siddharth Kumar
Siddharth Kumar - avatar
0
question why would you ever want to nest a comment
18th Jul 2018, 12:11 PM
hinanawi
hinanawi - avatar