我的程序如下~~
#include<stdio.h>
#include<string.h>
float fun(int,char **);
int main()
{
char ss[10][87];int numz=0;float k;
do
{
printf("输入第%d个字符串:\n",numz);
gets(ss[numz]);
numz+=1;
}while(*ss[numz-1]!="****");
numz-=2;
k=fun(numz,ss);
printf("地址是:%f\n",k);
return 0;
}
float fun(int num,char **max)
{
int i;
char s[10][87];
s[0]=*(max);
for(i=0;i<=num-1;i++)
{
if(strlen(s)<strlen(*(max+i+1)))
s[0]=*(max+i+1);
}
printf("最长的字符串是:\n");
puts(s[0]);
*max=s[0];
return (max);
}
--------------------Configuration: lianan - Win32 Debug--------------------
Compiling...
lianan.c
C:\Documents and Settings\Administrator\桌面\编程\lianan.c(12) : warning C4047: '!=' : 'int ' differs in levels of indirection from 'char [5]'
C:\Documents and Settings\Administrator\桌面\编程\lianan.c(14) : warning C4047: 'function' : 'char ** ' differs in levels of indirection from 'char [10][87]'
C:\Documents and Settings\Administrator\桌面\编程\lianan.c(14) : warning C4024: 'fun' : different types for formal and actual parameter 2
C:\Documents and Settings\Administrator\桌面\编程\lianan.c(22) : error C2106: '=' : left operand must be l-value
C:\Documents and Settings\Administrator\桌面\编程\lianan.c(25) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'char [10][87]'
C:\Documents and Settings\Administrator\桌面\编程\lianan.c(25) : warning C4024: 'strlen' : different types for formal and actual parameter 1
C:\Documents and Settings\Administrator\桌面\编程\lianan.c(26) : error C2106: '=' : left operand must be l-value
C:\Documents and Settings\Administrator\桌面\编程\lianan.c(31) : error C2115: 'return' : incompatible types
Error executing cl.exe.
斯蒂芬大帝
牧羊人nacy
扬帆大鱼