#include<stdio.h>
#include<string.h>
struct Age//定义结构体
{
int year;
int month;
int day;
};
struct Student//定义结构体
{
char name[20]; //姓名
struct Age birthday; //生日
}student1,*point;
int main(void)
{
//struct Student student1; //定义结构体变量student1
//struct Student *point=NULL; //定义一个指向Student结构体类型的指针变量point
point = &student1; //point指向结构体变量student1的首地址, 即第一个成员的地址
strcpy((*point ).name, "凤凰山"); //(*point).name等价于student1.name
(*point ).birthday.year = 2000;
(*point ).birthday.month = 4;
(*point ).birthday.day = 29;
printf("姓名:%s\n", (*point).name); //(*point).name不能写成point
printf("姓名: %s\n",point->name);//也可写成结构体指针指向结构体成员
printf("生日:%d-%d-%d\n", (*point).birthday.year, (*point).birthday.month, (*point).birthday.day);
return 0;
}