/*
编写函数any(s1,s2),将字符串s2中的任一字符在字符串s1中第一次出现的位置作为结果返回.
如果s1中不包含s2中的字符,则返回-1.
*/
int any(char *s1,char *s2)
{
/*遍历s2,直到'/0'*/
/*如果在s1中有匹配的,则返回位置*/
/*返回-1*/
int i=0;
for(; *s2!='/0';s2++){
for(i=0;s1[i]!='/0';i++){
if(s1[i]==*s2)return i;
}
}
return -1;
}
编写函数any(s1,s2),将字符串s2中的任一字符在字符串s1中第一次出现的位置作为结果返回.
如果s1中不包含s2中的字符,则返回-1.
*/
int any(char *s1,char *s2)
{
/*遍历s2,直到'/0'*/
/*如果在s1中有匹配的,则返回位置*/
/*返回-1*/
int i=0;
for(; *s2!='/0';s2++){
for(i=0;s1[i]!='/0';i++){
if(s1[i]==*s2)return i;
}
}
return -1;
}