您的位置:首页 > 其它

stringMatching Errs

2011-05-25 12:48 127 查看
]#include<stdio.h>
#include<string.h>
int stringMatching(char* pattern, char* text){

int pLen=strlen(pattern),tLen=strlen(text);
for(int i=0;i<=tLen-pLen;i++){
for(int j=0;pattern[j]=text[i+j];j++);
if(j==pLen)
return i;
}
return -1;//Not Found
}
int main(){
char a[ ];
char b[ ];
printf("请输入一行字符,在100个字以内/n");
gets(a);
printf("请再输入一行字符,比前者长/n");
gets(b);
stringMatching(a,b);
}


错误表明:

[Error] D:/Program Files/C-Free 5/mingw/include/c++/3.4.5/strMatching.cpp:7: error: using obsolete binding at `j'

[Error] D:/Program Files/C-Free 5/mingw/include/c++/3.4.5/strMatching.cpp:14: error: storage size of `a' isn't known

[Error] D:/Program Files/C-Free 5/mingw/include/c++/3.4.5/strMatching.cpp:15: error: storage size of `b' isn't known

我知道是我的main函数写的有问题,可是该怎么改呢?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: