c语言显示八进制和十六进制数

int main(int argc, const char * argv[])

{

    int x = 100;

    printf("dec = %d; octal = %o; hex = %x\n",x,x,x);

    printf("dec = %d; octal = %#o; hex = %#x\n",x,x,x);

    printf("sizeof(int) = %lu",sizeof(int));

    return 0;

}

dec = 100; octal = 144; hex = 64

dec = 100; octal = 0144; hex = 0x64

sizeof(int) = 4

原文地址:https://www.cnblogs.com/sell/p/2832366.html