/*
* Find the first occurrence in 'str' of any of the characters in 'chars' and
* return a poniter to the location. If none are found, or if 'str' or 'chars'
* NULL pointers, a NULL pointer is returned.
*
* 2010-11-20
* got it.
*/
#define NULL 0
/* 返回指针的函数 */ char *find_char( char const *str, char const *chars ) { char *cp; /* check arguments for NULL */ if( str != NULL && chars != NULL ) { for( ; *str != NULL; str++ ) { for( cp = chars; *cp != '\0'; cp++ ) if( *str == *cp ) return str; } } return NULL; }
|
阅读(1167) | 评论(1) | 转发(0) |