这是个例子 ,自己看吧!
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
struct student
{
char * name;
char * id;
char * great;
};
struct test
{
struct student *std;
};
int main()
{
struct test * p = (struct test *)malloc(sizeof(struct test));
p->std = (struct student *)malloc(sizeof(struct student));
p->std->name = “xiap”;
p->std->id = “1”;
p->std->great = “2”;
printf(“%s-%s-%s\n”,p->std->name,p->std->id,p->std->great);
return 0;
}