#include "stdio.h"
#include
int f(char *a,char *b){
char *p=strstr(a,b);
return p ? p-a : -1;
}
int main(int argv,char *argc[]){//验证主函数
char *a="1234567890",*b="4567";
(x=f(a,b))>=0 ? printf("%d\n",x) : printf("No overlap...\n");
//printf("%d\n",strcspn(a,b));//这是调用库函数直接求得
return 0;
}
运行结果: