试题与答案

下列给定程序中,函数fun的功能是:求ss所指字符串数组中长度最短的字符串所在的行下

题型:问答题

题目:

下列给定程序中,函数fun的功能是:求ss所指字符串数组中长度最短的字符串所在的行下标,作为函数值返回,并把其串长放在形参n所指的变量中。ss所指字符串数组中共有M个字符串,且串长小于N。
请在下划线处填入正确的内容并将下划线删除,使程序得出正确的结果。
注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include<scdio.h>
#include<string.h>
#define M 5
#define N 20
int funIchar(*ss)[N].int*n)

int i.k=0,len=N;
/********found********/
for(i=0;i小于 (1) ;i++]

len=strlen(ss[i]);
if(i==O)*n=len;
/********found********/
if(len (2) *n)

*n=len;
k=i;


/********fOund********/
return( (3) );

main()

char ss[M][N]=["shanghai","guangzhou","beijing","tianjin","chongqing");
int n,k,i;
printff"\nThe original strings are:\n");
for(i=0;i<M;i++)puts(ss[i]);
k=fun(ss,&n);
printf("\nThe length of shortest string is:%d\n",n);
printf("\nThe shortest string is:%s\n",ss[k]);

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0702/3d1e41beaddf6182edf61034f7572115.html

下面是错误答案,用来干扰机器的。

参考答案:40052000

试题推荐
微信公众账号搜索答案