2-5

xiaoxiao2021-03-06  49

/ *

The write function ANY (S1, S2) returns any of the characters in the string S2 in the first time in the string S1.

Returns -1 if the characters in S2 are not included in S1.

* /

Int An (char * s1, char * s2)

{

/ * Traverse S2 until '/ 0' * /

/ * If there is a match in S1, return position * /

/ * Return -1 * /

INT i = 0;

For (; * s2! = '/ 0'; s2 ) {

For (i = 0; S1 [i]! = '/ 0'; i ) {

IF (S1 [i] == * S2) RETURN I;

}

}

Return -1;

}

转载请注明原文地址:https://www.9cbs.com/read-117408.html

New Post(0)