+ 3
Why do I get 'expected primary expression' error on if statement?
I have this weird problem with my program, here is the code: char a; std::cin >> a; if (a !== "") //do something In the if statement, I get the error 'expected primary expression' before the second equals sign. Why?
2 Answers
+ 6
First, the 'not equal to' is not !==. 'not equal to' must be !=.
Another error, you declared a as char but double quotation mark only use for string. You must use single quotation mark like this: a!='c'
0
Thank you!