马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<stdio.h>
#include<stdlib.h>
int index( char str1[], char str2[], int pos )
——{ //此处提醒。——conflicting types for built-in fuction 'index'.
int j=1;
int i=pos;
while( i<=str1[0] || j<=str2[0] )
{
if( str1[i] == str2[j] )
{
i++;
j++;
}
else
{
i = i-j+2;
j = 1;
}
}
if( j > str2[0] )
{
return i-str2[0];
}
else
{
return 0;
}
}
int main()
{
int a, pos=1;
char str1[20] =" ilovefishc.com";
char str2[20] =" fishc";
str1[0] = 14;
str2[0] = 5;
a=index( str1, str2, pos );
printf("The location of the start equal:");
printf("%d\n",a);
return 0;
}
我发个看看。:sad#include<stdio.h>
#include<stdlib.h>
int index( char str1[], char str2[], int pos )
——{ //此处提醒。——conflicting types for built-in fuction 'index'.
int j=1;
int i=pos;
while( i<=str1[0] || j<=str2[0] )
{
if( str1[i] == str2[j] )
{
i++;
j++;
}
else
{
i = i-j+2;
j = 1;
}
}
if( j > str2[0] )
{
return i-str2[0];
}
else
{
return 0;
}
}
int main()
{
int a, pos=1;
char str1[20] =" ilovefishc.com";
char str2[20] =" fishc";
str1[0] = 14;
str2[0] = 5;
a=index( str1, str2, pos );
printf("The location of the start equal:");
printf("%d\n",a);
return 0;
}
看看这个能发吗? |