#include <stdio.h>
int main(void)
{
int i = 15;
printf("(int) i++: %d, i: %d\n", i++, i);
float j = 15.0;
printf("(float) j++: %g, j: %g\n", j++, j);
double k = 15;
printf("(double) k++: %g, k: %g\n", k++, k);
return 0;
}
--------------------------
Output:
(int) i++: 15, i: 16
(float) j++: 15, j: 15
(double) k++: 15, k: 16
--------------------------
Note the difference between the usage
of %f and %g
As a good practice, use increment/decrement
operator on int type data
As per my understanding it isn't as good programming style to use increment/decrement operator on values of float data type, given the nature of the operator that clearly increases or decreases the value by 1 based on the operator used.