整型提升练习题01

  • 阿里云国际版折扣https://www.yundadi.com

  • 阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
    #include<stdio.h>

    int main() {
    char a = -1;
    //-1原码=10000000 00000000 00000000 00000001
    //-1反码=11111111 11111111 11111111 11111110
    //-1补码=11111111 11111111 11111111 11111111
    //char只能存储一个字节长度:a=11111111
    signed char b = -1;
    //同理,b=11111111
    unsigned char c = -1;
    //同理,c=11111111
    printf("%d %d %d", a, b, c);
    //a整型提升(有符号位):11111111 11111111 11111111 11111111(补码)
    //b整型提升(有符号位):11111111 11111111 11111111 11111111(补码)
    //两者原码:10000000 00000000 00000000 00000001=-1
    //c整型提升(无符号位):00000000 00000000 00000000 11111111(补码=反码=原码)c=255
    return 0;
    }
  • 阿里云国际版折扣https://www.yundadi.com

  • 阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6