0
What is a output and how ?
void main () { int x,a,b,c; a = 2; b = 4; c = 5; x = a-- + b++ - ++c; printf("x: %d",x); }
8 Answers
+ 4
First, thanks for clearing the irrelevant links, now I'll try to explain it, I will assume you understand the first 2 lines, as they are just variable declaration, and value assignment.
The result is zero, because in the line where the calculation is done, a & b still have their previous value, only c is incremented instantly, because it is the only operand calculated using the pre-increment.
void main ()
{
int x,a,b,c;
a = 2; b = 4; c = 5;
// x = 2 + 4 - 6
x = a-- + b++ - ++c;
printf("x: %d",x);
}
Hth, cmiiw
+ 3
I'll answer if you remove those irrelevant links from your question :)
+ 2
You're welcome :)
0
????
0
kk
0
what is the output of this program
0
and how
0
ok thanks