#include <stdio.h>
#include <stdlib.h>
int main()
{
char *p = (char *) malloc(100);
//sizeof()返回结果是字节数
int n = sizeof(*p);//代表char类型,结果是1
//int n = sizeof(p) 代表指针类型大小,结果是4或8,取决于你的环境是32位系统还是64位系统
printf("%d",n);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
char *p = (char *) malloc(100);
//sizeof()返回结果是字节数
int n = sizeof(*p);//代表char类型,结果是1
//int n = sizeof(p) 代表指针类型大小,结果是4或8,取决于你的环境是32位系统还是64位系统
printf("%d",n);
return 0;
}