#include <stdio.h>
int find_char( char **strings, char value)
{
while( *strings != NULL)
{
while( **strings != '\0')
{
if( value == *(*strings)++ )
{
return 1;
}
}
strings++;
}
return 0;
}
int main()
{ char *str[10] = {"hello", "world", "abcd",NULL};
char ch = 'f';
if( find_char(str, ch) == 1 )
{
printf("%c was found!\n", ch);
}
else
{
printf("%c was not found!\n", ch);
}
return 0;
}
在一些字符串中找特定字符
最新推荐文章于 2022-01-28 09:38:08 发布