}
/*修改学号为i的学生的记录函数*/
int Change_list (int i, Element s[ ] )
{
if( (i<1) | | (i>Max_length +1) ) return (0);
printf (“Input data for updating :\n”);
scanf (“%d%s%d%d%d”,s[i].xh,s[i].name,s[i].c1,s[i].c2,s[i].c3); return (1);
}
/*打印已建立的数据记录,n是记录总数*/
void printf_list (Element s[ ],int n)
{
int i;
if(n>Max_length) return ;
printf (“XH Name C1 C2 C3 \n”);
printf(“--------------------------------------------\n”);
for(i=1;i<=n;i++)
printf (“%4d%10s%7d%7d%7d\n”,s[i].xh,s[i].name,s[i].c1,s[i].c2,s[i].c3) }
(2)编写主函数调用上述各函数。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void main ( )
{
int i, records=0;
Element s[Max_length];
for (i=1;i<=Max_length;i++) Insert_list ( i, s, &records); return (0);