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

posted @ 2012-12-25 14:29  diablo大王  阅读(2855)  评论(0编辑  收藏  举报