struct People //定义一个人的结构体
{
int age; //年龄
char name[20]; //名字,用数组存储
};
int main()
{
People *p=NULL; //定义一个people类型的指针
p=(People *)malloc(sizeof(People)); //向内存申请一个装的下people的内存
p->age = 21; //指针p指向age,并赋值
strcpy(p->name,"Sam"); //将sam拷贝到指针p指向的name
printf("%d,%s ",p->age,p->name);
free(p); //释放 p内存
return 0;
}