#include <stdio.h> typedef struct { long num; char name[10]; double score; } Stu; int main() { Stu stu[3] = {20115602l, "Jerry", 99.5, 20115600l, "Elaine", 94.5, 20115607, "Kramer", 78}, *p = stu; int i; for (i = 0; i < 3; ++i, p++) { if (p->score >= 90) printf("%10ld%10s%6.1f ", p->num, p->name, p->score); } return 0; }
//++p->x 与++(p->x)相同
(++p)->x
#include <stdio.h> typedef struct { int x, *y; } link; int main() { int a[4] = {100, 20, 25, 30}; link scores[] = {10, &a[0], 15, &a[1], 16, &a[2], 17, &a[3]}; link *p = scores; printf("%d ", ++p->x); //11 printf("%d ", (++p)->x); //15 printf("%d ", ++(p->x)); //16 return 0; }