When I type my code like given below :
int a=10,b,c,d,e;
c= a++;
d = ++a;
e = ++a;
printf("value of c=%d, d =%d, e=%d",c,d,e);
it gives me an output like c =10
, d= 12
, e=13
and when we add these values,i.e 10+12+13
becomes 35
,
but when I code it like :
b = a++ + ++a + ++a;
printf("value of b=%d" ,b);
it gives me output 36
.
Can somebody describe what's the process behind this code and why the output of codes are different? Thank you!