Bygoewn历年全国计算机等级考试_二级C语言上机考试题库及答案
fun(___3___);
printf("\nThe result is :\n"); for(i=0; i<3; i++)
printf("%d,%s\n",std[i].num,std[i].name); } 修改
给定程序MODI1.c中函数fun的功能是:将m个字符串连接起来组成一个新串,放入pt所指存储区中
int fun ( char str[][10], int m, char *pt ) {
/************found************/ Int k, q, i ;
for ( k = 0; k < m; k++ ) { q = strlen ( str [k] ); for (i=0; i<q; i++)
/************found************/ pt[i] = str[k,i] ; pt += q ; pt[0] = 0 ; } } 设计
程序定义了N*N的二维数组, 并在主函数中自动赋值,请编写函数fun,函数的功能是:使数组左下三角元素中的值全部值0
14、B: *std PERSON std M: int str[k][i] P: int i, j; for(i = 0 ; i < N ; i++) for(j = 0 ; j <= i; j++) a[i][j] =0; 15.填空
给定程序中,函数fun的功能是:将形参std所指结构体数组中年龄最大者的数据作为函数值返回,并在主函数中输出 STD fun(STD std[], int n) { STD max; int i; /**********found**********/ max= ___1___; for(i=1; i<n; i++)
/**********found**********/
if(max.age<___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);