The following code snippets although quite same but giving different answers
#include <stdio.h>
int main() {
signed char c = -128;
c = -c;
printf("%d", c);. //-128
return 0;
}
And:
#include <stdio.h>
int main() {
signed char c = -128;
printf("%d", -c);. //expected -128 but got 128
return 0;
}
Could printf be doing internal typecasting??