I have to analyse the output of these code fragments:
int x, y;
x = 200; y = 100;
x = x+y; y = x-y; x = x-y;
printf ("%d %d\n", x, y);
char x, y;
x = 200; y = 100;
x = x+y; y = x-y; x = x-y;
printf ("%d %d\n", x, y);
So, I know now that int
stands for integer and char
for character; I've read about the differences and if I put in the printf
the %d
, it returns in the form of digits, and %c
, in the form of a character.
The ASCII character code for 'A'
is 65 for example, but why does the second function print 100 -56
, instead of 100 200
?