見代碼:
#include#includeint main(void){//直接常量時候c/c++解釋不同
printf("%lu\n",sizeof 'a');//4(c) 1(c++)
//之后的c/c++解釋相同
printf("%lu\n",sizeof "a");//2
char a = 'a';
const char *pa = "a";
printf("%lu\n",sizeof a);//1
printf("%lu\n",sizeof pa);//8
printf("%lu\n",sizeof 100);//4
printf("%lu\n",sizeof 100L);//8
return EXIT_SUCCESS;
}
編譯環(huán)境:
root@DESKTOP-BE054DB:/mnt/i# gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
Copyright ? 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
root@DESKTOP-BE054DB:/mnt/i# g++ --version
g++ (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
Copyright ? 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機房具備T級流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級服務(wù)器適合批量采購,新人活動首月15元起,快前往官網(wǎng)查看詳情吧