# include<stdio.h>
int main()
{
char *p;
int a,b,c;
printf("%d",sizeof a);
printf("%d\n",sizeof (a));
printf("%d\n",sizeof *p);
printf("%d\n",sizeof p);
printf("%d\n",4 * sizeof *p);
/// sizeof 的操作數(shù) 是類型名時(shí) 必須加上括號(hào) 這個(gè)讓很多人以為sizeof 是個(gè)函數(shù)
a = -1;
if(a > sizeof(10 * sizeof(int ))) // sizeof 是返回 unsigned int 的 當(dāng) int 和 unsigned int 遇上 會(huì)升級(jí)至 unsigned
printf("%ud 這個(gè)你也會(huì)很郁悶\n",a); //-1 就變成一個(gè)很大的數(shù)
return 0;
}
posted on 2011-03-21 17:38
付翔 閱讀(1734)
評(píng)論(4) 編輯 收藏 引用 所屬分類:
linux 及 c相關(guān)