Jun 20, 2013 at 1:10pm UTC
what is output of this C program..
this one is from book let us c
Jun 20, 2013 at 1:15pm UTC
Why don't you run it & find out?
Or are you wondering why the output is different to what you expected?
Last edited on
Jun 20, 2013 at 1:16pm UTC
Jun 20, 2013 at 3:48pm UTC
yep..the output is different from what i expect..
output is 10 20
but i didn't understand that y this program is not showing error becase here if statement is followed by semicolon(;)....
Jun 20, 2013 at 4:45pm UTC
Technically, there is nothing wrong with the statement
You are simply saying, "If x equals y, do nothing."
But x does not equal y anyhow, so it doesn't get executed.
What is the program supposed to do?
Jun 20, 2013 at 4:48pm UTC
this is due to the nature of the c++ compiler.
similarly the statement:
if (x = y)
does not produce a syntax error but does produce a logical programming error in almost all cases.
i think the idea of the example was to illustrate this.
Jun 20, 2013 at 7:24pm UTC
yeah i got it but according to my knowledge the syntax of if statement is
there is no any semicolon..