Code Snippet :
#include<iostream>
using namespace std;
int main()
{
int i = 0;
i = i + 1;
cout << i << " ";
/*comment\*// i = i + 1;
cout << i;
return 0;
}
Error :
expected primary-expression before '/' token.
Description :
In line 8, the multi-line comment is ended by '*/', but the syntax for single line comment '//' is wrong. So the compiler treats it as division operator '/'.
#include<iostream>
using namespace std;
int main()
{
int i = 0;
i = i + 1;
cout << i << " ";
/*comment\*// i = i + 1;
cout << i;
return 0;
}
Error :
expected primary-expression before '/' token.
Description :
In line 8, the multi-line comment is ended by '*/', but the syntax for single line comment '//' is wrong. So the compiler treats it as division operator '/'.
No comments:
Post a Comment