您的位置:首页 > 其它

在多个字符串中寻找一个字符

2015-03-28 18:29 113 查看
#include<stdio.h>
int find(char *p[4],char x)
{
while(*p!=NULL)//判断字符串
{
while(**p!='\0')//判断字符串的字符
{
if(x==**p)
{
return x;
}
else
{
(*p)++;
}
}
p++;
}
return 0;
}
int main()
{
char *p[4];//定义一个指针数组
p[0]="abcdef";
p[1]="bit";
p[2]="tech";
p[3]=NULL;

printf("%c\n",find(p,'c'));
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐