题目内容:
编写一个函数,从传入的M个字符中找出最长的一个字符串,并通过形参指针max传回该串地址(用****作为结束输入的标志)。 注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的花括号中填入所编写的若干语句。
试题程序:
#include<stdio.h>
#include<string.h>
#include<conio.h>
char*proc(char(*a)[81],int num)
{
}
void main()
{
char ss[l0][81],*max;
int n,i=0;
printf("输入若干个字符串:");
gets(ss[i]);
puts(ss[i]);
while(!strcmp(ss[i],"****")= =0)
{
i++:
gets(ssEi]);
puts(ss[i]);
}
n=i:
max=proe(SS,n);
printf("\nmax=%s\n",max);
}
参考答案:
答案解析: