I am not sure if incrementing a variable within a printf statement saves the valuable to a variable or not.
int x = 0;
The output will be 1.
++x will be
x = x+1;
In both the
printf() you get
So the value of x is modified with the pre-increment operator here and in
printf() in the second line prints the new value of x which is
printf() just prints the value of
x it doesn't modify your variable
Note the difference between pre-increment and post-increment .
With post-increment you will get
0 in the first printf() because the value of
x is fetched by the
%d and later
x gets incremented leading to the value of
x in the second prinf() to be