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