定义一个结构体如:
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.