Hi there. you have the following quiz question:
If x and y are integers, the statement
if ( x = 5 )
y = 0;
y = 1;
with the options being 0, 1, or invalid
I think this if statement is invalid, cause you need == to make it an equality comparison, and not an assignment,
but the quiz marks it as "wrong answer".
Am I thinking about this wrong?
EDIT: Nevermind. Reading the other threads I understand the trickiness of the question
Another reminder to think like the computer executing the code would "think"
I loved the question
int x = 100, y;
y = (x % 2) ? 50 : 0;
It reminded me to think hard about understanding the syntax before spending 10 minutes puzzling over "what's going on here"