- What is nested comments in C?
- Can we use nested comments in C?
- What are nested comments?
- Why nested comments are not allowed in C?
What is nested comments in C?
A nested comment is a comment inside another comment.
Can we use nested comments in C?
A comment can include any combination of characters from the representable character set, including newline characters, but excluding the "end comment" delimiter (*/). Comments can occupy more than one line but cannot be nested.
What are nested comments?
When someone comments on a previous comment, a “nest” is created. The first comment shows normally, but then the replies to the comment are categorized directly underneath the original comment.
Why nested comments are not allowed in C?
C and C++ do it for ease of parsing. This way, when they hit a comment start of /*, the parser can trivially scan to the end. Otherwise, it would have to set up and maintain a stack, and then report errors if the comment tokens are unmatched.