# 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 的操作數 是類型名時 必須加上括號 這個讓很多人以為sizeof 是個函數
a = -1;
if(a > sizeof(10 * sizeof(int ))) // sizeof 是返回 unsigned int 的 當 int 和 unsigned int 遇上 會升級至 unsigned
printf("%ud 這個你也會很郁悶\n",a); //-1 就變成一個很大的數
return 0;
}
posted on 2011-03-21 17:38
付翔 閱讀(1727)
評論(4) 編輯 收藏 引用 所屬分類:
linux 及 c相關