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(); }
标签:struct,int,P138,C语言,char,student,st,sizeof,源代码 来源: https://www.cnblogs.com/xkdn/p/16673132.html