#include
using namespace std;
typedef struct name{
char sname[10];
}Name;
typedef struct person{
Name *myname;
}Person;
int main()
{
Person wang;
wang.myname= (Name*)malloc(sizeof(Name));
scanf("%s",((wang.myname)->sname));
printf("%s\n",((wang.myname)->sname));
}
【定义一个结构体指针需要分配存储空间(malloc)】答案是需要的