中国大学MOOC: #include <stdio.h>#define N (sizeof(s)/sizeof(s[0]))struct porb {char *name; int age;} s[]={"LiHua",18,"WangXin",25,"LiuGuo",21};void f(struct porb a[], int n){int i;for (i=0;i<n;i++)printf ("%s:%d\n", a[i].name, a[i].age);}int main(){f(s, N); return 0;}
中国大学MOOC: #include <stdio.h>#define N (sizeof(s)/sizeof(s[0]))struct porb {char *name; int age;} s[]={"LiHua",18,"WangXin",25,"LiuGuo",21};void f(struct porb a[], int n){int i;for (i=0;i<n;i++)printf ("%s:%d\n", a[i].name, a[i].age);}int main(){f(s, N); return 0;}
1