结构体数组指针有点绕,使用和数组指针一样的
#include#include typedef struct { long int num; char name[20]; char sex; float score; } student; student stu_1[10], *p; int main(void) { p = &stu_1; stu_1[1].num = 89101; strcpy(stu_1[1].name, "LiLin"); p->sex='M'; p->score=89.5; printf("%ld, %s,%c,%fn", (p+1)->num, (p+1)->name,stu_1[0].sex,p->score); return 0; }