填空题
给定程序中,函数fun的功能是:将形参std所指结构体数组中年龄最大者的数据作为函数值返回,并在main函数中输出。
请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。
注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include<sfdio.h>
typedef struct
{char name[10];
int age;
}STD;
STD fun(STD std[], int n)
{STD max; int i;
/**********found**********/
max=
1;
for(i=1; i<n; i++)
/**********found**********/
if(max.ag<
2)max=std[i];
return max;
}
main()
{STD std[5]={"aaa", 17, "bbb", 16, "CCC", 18, "ddd", 17, "eee", 15};
STD max;
max=fun(std, 5);
printf("/nThe result:/n");
/**********found**********/
printf("/nName:%s, Age:%d/n",
3, max.age);
}