#include <stdio.h> #include <stdlib.h> #include <limits.h> int main() { char x=-2; unsigned char y=1; unsigned char z; z=x+y; printf("x+y=%x,%d,z=%d,%x\n",(x+y),(x+y),z,z); int a=-2; unsigned int b=1; unsigned int c; c=a+b; printf("x+y=%x,%d,z=%d,%x\n",(a+b),(a+b),c,c); //這里是結(jié)果是否算溢出,? return 0; } 結(jié)果: |
|