I have the following code
#include <stdio.h>
int main() {
char y=3, res=0;
res = ( (++y) * (++y) );
printf("res=%d y=%d \n", res, y);
return 0;
}
The result is:
res=20 y=5
Now when i change variable to int
it gives different results
#include <stdio.h>
int main() {
int y=3, res=0;
res = ( (++y) * (++y) );
printf("res=%d y=%d \n", res, y);
return 0;
}
The result is:
res=25 y=5
What happened to make res
value change?