算数转换
程序1:
#include<stdio.h>
int main()
{
char c1 = 128;
char c2 = 1;
char c3 = c1+c2;
//0111 1111
//0000 0001
//1000 0000,表示-127
printf("%dn",c3);
return 0;
}
结果:
-127
请按任意键继续. . .
程序2:
#include<stdio.h>
int main()
{
char c1 = 12;
char c2 = 1;
char c3 = c1+c2;
//0000 1100
//0000 0001
//0000 1101
printf("%dn",c3);
return 0;
}
结果:
13
请按任意键继续. . .