《C和指针》——6.1
6.1
题目:
编写一个函数,在一个字符串中进行搜索,查找另一子字符串中出现的字符。
函数原型如下:
char *find_char(char const *source, char const *chars);
要求:
a.不适用任何用于操纵字符串的库函数(如:strcpy strcmp等)
b.函数中不能使用下标引用
解答代码:
#include <stdio.h> char *find_char(char const *source, char const *chars) { int i, j; if ((*source != NULL) && (*chars != NULL)) { for (j=0; *(source+j) != '