//在一些字符串中搜索某个特定的字符值
int FindString(char **strings, char value)//strings是一个指向指针数组的指针,value是我们所查找的字符值
{
assert(strings != NULL);
char *string;//我们当前正在查找的字符串
while ((string=*strings++)!=NULL)//对于列表中的每个字符串
{
//观察字符串中的每个字符,看看是不是我们想要查找的那个
while (string++!=‘\0’)
{
if (*string++ ==value)
return 1;
}
}
return 0;
}
int FindString(char **strings, char value)//strings是一个指向指针数组的指针,value是我们所查找的字符值
{
assert(strings != NULL);
char *string;//我们当前正在查找的字符串
while ((string=*strings++)!=NULL)//对于列表中的每个字符串
{
//观察字符串中的每个字符,看看是不是我们想要查找的那个
while (string++!=‘\0’)
{
if (*string++ ==value)
return 1;
}
}
return 0;
}
本文介绍了一个用于在字符串数组中搜索特定字符的C语言函数。该函数遍历字符串数组,并在每个字符串内查找指定的字符。如果找到该字符,则返回1;否则,在检查完所有字符串后返回0。
269

被折叠的 条评论
为什么被折叠?



