在多个字符串中寻找一个字符
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; }
相关文章推荐
- 要验证这样一个字符串,其中不能包含多个字符
- 一个字符串中可能包含a~z中的多个字符,如有重复,如String data="aavzcadfdsfsdhshgWasdfasdf",求出现次数最多的那个字母及次数,如有多个重复的则都求出。
- 输入一个字符串,同时输入帧头和帧尾(可以是多个字符),将该字符串中合法的帧识别出来.
- Linux_C练习:输入一个字符串,同时输入帧头和帧尾(可以是多个字符),将该字符串中合法的帧识别出来。提示:帧头和帧尾分别是head和tail 字符串”asdheadhauboisoktai
- 输入一个字符串,同时输入帧头和帧尾(可以是多个字符),将该字符串中合法的帧识别出来. 提示:帧头和帧尾分别是head和tail 字符串”asdheadhauboisoktail”中headhau
- 输入一个字符串,同时输入帧头和帧尾(可以是多个字符),将该字符串中合法的帧识别出来.
- 输入一个字符串,同时输入帧头和帧尾(可以是多个字符),将该字符串中合法的帧识别出来.
- 给定一个字符串str,将str中连续两个字符为a的字符替换为b(一个或连续超过多个字符a则不替换)
- [经典面试题][搜狗]在一个字符串中寻找包含全部出现字符的最小字串
- C# 3.0 Cookbook:一、字符与字符串处理(3):在一个字符串内寻找另一个字符串出现的所有位置
- 一个字符串参数(s)由字母(a-z,A-Z)组成, 且最大字符位数为40,要求写一个函数, 返回该参数中连续相同字母的最大个数及该字母,如果最大位数有多个,则返回第一个。例:字符串“aaaddxxxxddddxxxx”,返回值为:“x,4”。
- iOS开发-- 字符串分割(多个字符分割一个字符串)、拼接
- 题目:输入一个字符串,同时输入帧头和帧尾(可以是多个字符),将该字符串中合法的帧识别出来. 提示:帧头和帧尾分别是head和tail 字符串”asdheadhauboisoktail”中headha
- 输入一个字符串,同时输入帧头和帧尾(可以是多个字符),将该字符串中合法的帧识别出来。
- 【嵌入式系统学习记录】习题:输入一个字符串,同时输入帧头和帧尾(可以是多个字符),将该字符串中合法的帧识别出来。比如:帧头和帧尾分别是head和tail 字符串”asdheadhauboiso
- 一个字符串中可能包括a-z中的多个字符,如有重复,求出现最多次数的那个字符及次数,如有多个重复的则都求出
- 一个字符串中可能包含a~z中的多个字符,如有重复,如String data="aavzcadfdsfsdhshgWasdfasdf",求出现次数最多的那个字母及次数,如有多个重复的则都求出。
- 输入一个字符串,同时输入帧头和帧尾(可以是多个字符),将该字符串中合法的帧识别出来. 提示:帧头和帧尾分别是head和tail 字符串”asdheadhauboisoktail”中headhaubo
- 输入一个字符串,同时输入帧头和帧尾(可以是多个字符),将该字符串中合法的帧识别出来. 提示:帧头和帧尾分别是head和tail 字符串”asdheadhauboisoktail”中headhau
- 寻找一个字符串中第一个只出现两次的字符