C语言 重写C语言库strchr字符串操作函数
2015-04-11 12:01
190 查看
#include<stdio.h> #include<string.h> const char *my_strchr(char const *str,int ch) { int i=0; for(;str[i]!='\0';i++) { if(str[i]==ch) { return str+i; } } return NULL; } int main() { char ch='c'; char src[]="abcdecf"; char const *ret; ret=my_strchr(src,ch); printf("%s\n",ret); return 0; }
相关文章推荐
- 重写string.h中的字符串操作函数--strchr
- (C语言)自己写字符串操作函数(一)——strlen/strcpy/strcat/strcmp/strchr/strpbrk/strstr等相关函数
- c语言中字符串的函数strstr()和strchr()的操作一
- C语言字符串操作函数 - strcpy、strcmp、strcat、反转、回文
- 重写string.h中的字符串操作函数--strspn和strcspn
- C语言中操作字符串的一些函数源代码
- 重写string.h中的字符串操作函数--strcpy
- 【转贴】C语言中操作字符串的一些函数源代码
- C语言中操作字符串的一些函数源代码
- Linux下常用C语言字符串操作函数
- 重写string.h中的字符串操作函数--strncat
- 重写string.h中的字符串操作函数--strncpy
- 重写string.h中的字符串操作函数--strcmp
- C语言字符串操作函数总结
- c语言中操作字符串的函数
- C语言字符串操作函数 - strcpy、strcmp、strcat、反转、回文
- 重写string.h中的字符串操作函数--memmove、memcpy
- c语言中的字符串操作函数
- C语言字符串操作函数
- C语言字符串操作函数 - strcpy、strcmp、strcat、反转、回文