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); }

27th Oct 2017, 6:10 PM
sai mahale
sai mahale - avatar
8 Respostas
+ 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
27th Oct 2017, 8:48 PM
Ipang
+ 3
I'll answer if you remove those irrelevant links from your question :)
27th Oct 2017, 8:05 PM
Ipang
+ 2
You're welcome :)
28th Oct 2017, 10:51 AM
Ipang
0
????
27th Oct 2017, 6:10 PM
sai mahale
sai mahale - avatar
0
kk
27th Oct 2017, 8:19 PM
sai mahale
sai mahale - avatar
0
what is the output of this program
27th Oct 2017, 8:21 PM
sai mahale
sai mahale - avatar
0
and how
27th Oct 2017, 8:21 PM
sai mahale
sai mahale - avatar
0
ok thanks
28th Oct 2017, 6:26 AM
sai mahale
sai mahale - avatar