+ 1

How does the compiler ignores the comments by the two slashes even in comments there is no semicolons that terminates the lines?

It is of the c++ lang. In it the cout defines printing the text and a new statement but..... //print "hello world" Cout<<"hello world"; How compiler ignores the comment without the semicolon even no new line tag is added /n?

26th Jul 2020, 3:18 AM
Saumya Pratap Singh
Saumya Pratap Singh - avatar
1 Antwort
+ 3
You have essentially answered your own question. The compiler ignores the rest of the line that is followed by //. You can write whatever you want after the // symbol until the rest of that line, the compiler doesn't care and completely ignores whatever is written after the // symbol that is on the same line. Similarly, anything written between /* */ is ignored completely by the compiler
26th Jul 2020, 4:15 AM
Edward Finkelstein
Edward Finkelstein - avatar