填空题
下列给定程序中,函数fun的功能是:在形参ss所指字符串数组中,将所有串长超过k的字符串中后面的字符删除,只保留前面的k个字符。ss所指字符串数组中共有N个字符串,且串长小于M。
请在下划线处填入正确的内容并将下划线删除,使程序得出正确的结果。
注意
:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include <stdio.h>
#include <string.h>
#define N 5
#define M 10
/********found********/
void fun(char (*ss)
1,int k)
{int i=0;
/********found********/
while(i<
2){
/********found********/
ss[i][k]=
3;i++;}
}
main()
{char x[N][M]={"Create","Modify","Sort","skip","Delete"};
int i;
printf("/nThe original string/n/n");
for(i=0;i<N;i++)puts(x[i]);
printf("/n");
fun(x,4);
printf("/nThe string after deleted:/n/n");
for(i=0;i<N;i++)puts(x[i]);
printf("/n");
}