P138-3 源代码C语言
#include <stdio.h> struct student{ char name[12]; char number[9]; int score; }; struct student st[3]={{"zhang liang","19040301",87},{"li hong","18040302",92},{"yan feng","20040303",83}}; void fun2(struct student pd[],int x){ struct student st1; int a; int len=sizeof(st)/sizeof(st[0]); if (x<=len) { for(a=0;a<x;a++) { printf("第%d同学的姓名:%s,学号:%s,成绩:%d\n",a,pd[a].name,pd[a].number,pd[a].score); } } } main() { struct student st2; int n; scanf("%d",&n); fun2(st,n); getchar(); }