Code Snippet :
#include<iostream>
using namespace std;
int main()
{
int i = 5;
while(i)
{
switch(i)
{
default:
case 4:
case 5:
break;
case 1:
continue;
case 2:
case 3:
break;
}
i-;
}
return 0;
}
Error :
expected primary-expression before ';' token.
Description :
In line 20, the syntax for unary operator is wrong. It should be 'i--;' instead of 'i-;'.
#include<iostream>
using namespace std;
int main()
{
int i = 5;
while(i)
{
switch(i)
{
default:
case 4:
case 5:
break;
case 1:
continue;
case 2:
case 3:
break;
}
i-;
}
return 0;
}
Error :
expected primary-expression before ';' token.
Description :
In line 20, the syntax for unary operator is wrong. It should be 'i--;' instead of 'i-;'.
No comments:
Post a Comment