定義一個結構體如:
typedef struct Image
{
int iWidth;
int iHeight;
}Image;
Image *pImage;
sizeof(*pImage)返回長度爲8:因爲*pImage代表的意思是pImage所指向Image變量,故長度爲8。
sizeof(pImage)返回4:此時pImage是一個指針變量,所有指針變量的長度都是4.
定義一個結構體如:
typedef struct Image
{
int iWidth;
int iHeight;
}Image;
Image *pImage;
sizeof(*pImage)返回長度爲8:因爲*pImage代表的意思是pImage所指向Image變量,故長度爲8。
sizeof(pImage)返回4:此時pImage是一個指針變量,所有指針變量的長度都是4.