#include
#define num 3struct date
{
int day;
int month;
int year;
};
void input(struct date*);
void output(struct date*);
int main()
{
struct date times[num];
input(times);
output(times);
}void input(struct date*p)
{
int i;
for(i=0;
iday);
printf("please enter the month%d:",i+1);
scanf("%d",&(p+i)->month);
printf("please enter the year%d:",i+1);
scanf("%d",&(p+i)->year);
}
}void output(struct date*p)
{
int i;
for(i=0;
iday,(p+i)->month,(p+i)->year);
}
}
p指向struct[0],p+1指向struct[1]
【结构体数组与结构体数组指针】
文章图片