The following code prints a value of 9. Why? Here return(i++) will return a value of 11 and due to --i the value should be 10 itself, can anyone ex
There are two examples illustrates difference
int a , b , c = 0 ;
a = ++c ;
b = c++ ;
printf (" %d %d %d " , a , b , c++);
a = 1 and value of c = 1next statement assiagn value of c = 1 to b then increment c by 1 so
value of b = 1 and value of c = 2
in printf statement we have c++ this mean that orginal value of c
which is 2 will printed then increment c by 1 so printf statement
will print 1 1 2 and value of c now is 3
you can use http://pythontutor.com/c.html
int a , b , c = 0 ;
a = ++c ;
b = c++ ;
printf (" %d %d %d " , a , b , ++c);
printf statement ++c will increment value of c by 1 first then
assign new value 3 to c so printf statement will print 1 1 3