answersLogoWhite

0


Best Answer

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.

As to why Java does it, the answer is simple - Java's syntax was designed to emulate C and C++, to trick people into thinking it was just as fast (in the beginning, Java was purely interpreted, so this trick WAS necessary to get traction). If nested comments were allowed, it might trip up some C programmers, and many angry blog posts would be written!

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why nested comment are not allowed on C language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the compound in c language?

compound c language is complicated where we need to use many nested functions and loops


What is difference between select Case statement and nested loop in c programming in UNIX?

UNIX has no bearing on the C language; it is cross-platform. There is no select/case in C, you probably meant switch/case. However, a switch/case is a conditional jump while a nested loop is a loop within a loop. Besides the C language they have nothing in common with each other.


What is comment in c programming?

COMMENT:- comment a re not necessary in the program. however, to understand the flow of programs the programmer can include comments in the program. comment are to be inserted by the programmer. It is useful for documentation.Comment are nothing but some kind of statements which are placed between the delimiters /* & */. The compiler does not execute comments. Thus, we can say that comments are not the part of executable program.The user can frequently use any number of comments that can be placed any where in the program. Please note that the comments and statements can be nested. The user should select the OPTION MENU of the editor and select the COMPILER - SOURCE -NESTED COMMENTS ON/OFF). The Comments can be inserted with a single statement or in nested statement.Types of comment in c/c++. is following bellow1. // this is a single line comment2. /* */ this sing is multi line OR nested line commentseg. /* int i=90;char ch=65; */ close multi line commentsmade by [ARUN KUMAR RAI]


Can include files be nested in c?

Yes, include files can be nested in C and C++. In fact, most library implementations do just that.


What starts a comment in a C-base language?

// This is a one-line comment /* This is another comment Everything between the slash-star and the star-slash is commented out If you forget to close this comment you will get a compiler error */


Can you have nested header files in C?

Yes.


How does one indicate that certain text is to be treated as a comment in the classic C language?

Place the text between /* */ .


What is nested class in c plus plus?

s.


What are the ways to comment statement in C?

Most of C/C++ will support two types of comments:* // Comment text goes here (aka inline)* /* Comment goes here */ (aka block)But the first comment type is not in ANSI C standard, you will get an error message.In order to compile your program with ASNI C standard using GCC, I suggest this:gcc -Wall -ansi -pedantic -oRemoving "-ansi" would allow usage of the first type comments in C language.


What is the definition of 'nested' in C programming?

In C a structure within a structure is called nested. For example, you can embed a while loop in another while loop or for loop in a for loop or an if statement in another if statement.


In C which loop is embedded within another loop?

The nested loop.


What are the types of comment in C?

Single line Eg: 1 //This is a Single line comment ii. Multiple line (/* */) Eg: 1 2 3 /*This is a multiple line comment We are in line 2 Last line of comment*/ iii. XML Comments (///). Eg: C# 1 2 3 /// summary; /// Set error message for multilingual language. /// summary