sizeof() in 'C'
Below code was compiled and executed on a 32-bit machine where size if 'int' is '4':
#include “stdio.h”
int main() {
int i = 0, j = 0;
j = sizeof(++i);
printf("i = %d\nj = %d\n", i, j);
return 0;
}
Why hhe output is
i = 0
j = 4
instead of
i = 1
j = 4
I know the answer but thought to post it as a query before sharing the cause of this behavior.
-Pradeep