填空题
下列给定程序中,函数fun的功能是:从形参SS所指字符串数组中,删除所有串长超过k的字符串,函数返回剩余字符串的个数。ss所指字符串数组中共有N个字符串,且串长小于M。
请在下划线处填入正确的内容并将下划线删除,使程序得出正确的结果。
注意
:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
#include<string.h>
#define N 5
#define M 10
int fun(char (*ss)[M],int k)
{int i,j=0,len;
/********found********/
for{i=0;i<
1;i++)
{len=strlen(ss[i]);
/********found********/
if(len<=
2)
/********found********/
strcpy(ss[j++],
3);
}
return j;
}
void main()
{char x[N][M]={"Beijing","Shanghai","Tianjin","Nanjing","Wuhan"};
int i,f;
printf("/nThe original string/n/n");
for(i=0;i<N;i++)puts(x[i]);
printf("/n");
f=fun(x,7);
printf{"The string witch length is less thanor equal to 7:/n");
for(i=0;i<f;i++)puts(x[i]);
printf("/n");
}