回复 10楼 ehszt
我知道是带了下标。我不理解同样是地址。那个&代表的含义又是什么
#include<stdio.h> #include<malloc.h> typedef struct { int num[15]; char name[15]; float score[3]; double aver; double sum; }Stu; void input (Stu* p, int n) { int i, j; for (i = 0; i < n ; i++) { printf("input score of student%d\n", i + 1); scanf("%d%s",&p[i].num, p[i].name); for (j = 0; j < 3; j++) scanf("%f", &p[i].score[j]); } } void Handle (Stu* p, int n) { int i, j; for (i = 0; i < n; i++) {p[i].sum = 2.0; printf("%d", *p[i].num); printf("%lf", p[i].sum); } } int main () { int n; Stu *St; printf("please input N students information!\n"); scanf("%d", &n); St=(Stu* )malloc(n * sizeof(Stu)); input(St, n); Handle(St, n); free(St); }