字符串操作函数的编写
来源:互联网 发布:mac word崩溃文件恢复 编辑:程序博客网 时间:2024/06/05 09:07
size_t my_strlen(char const *string)//字符串长度{ assert(string != NULL); size_t count = 0; while (*string++ != '\0') count++; return count;}char *my_strcpy(char *dst, char const *src){ assert(dst != NULL); assert(src != NULL); char *ret = dst; while (*dst++ = *src++) ; return ret;}char *my_strcat(char *dst, char const *src){ assert(dst != NULL && src != NULL); char *ret = dst; while (*dst) { dst++; } while (*dst++ = *src++) ; return ret;}int my_strcmp(char const *dst, char const *src){ assert(dst != NULL&&src != NULL); while (*dst && *src && (*dst++ == *src++))//源字符串和目的字符串一个为\0或者都是\0或者两个不相等的时候跳出循环 ; return *dst - *src;//返回他们的差 0相等}
本文出自 “aiali” 博客,请务必保留此出处http://aliddd.blog.51cto.com/10780547/1711625
0 0
- 字符串操作函数的编写
- C语言自己编写的字符串操作的函数
- 自己编写c语言实现的字符串操作函数
- 操作字符串的函数
- 字符串操作的函数
- 字符串的操作函数
- 字符串的操作函数
- 编写一个截取字符串的函数
- 编写一个截取字符串的函数
- 编写一个截取字符串的函数
- 编写一个截取字符串的函数
- Java编写截取字符串的函数
- 编写一个截取字符串的函数
- 编写一个截取字符串的函数
- 编写一个截取字符串的函数
- 3.编写一个截取字符串的函数
- java编写截取字符串的函数
- 一些自己编写的字符串函数
- c语言中递归函数真的好吗?
- c语言中对可变参数列表的简单理解
- c语言中统计二进制位中1的个数的算法优化
- c语言最强大之处--指针
- 用python写一个简单的爬虫功能
- 字符串操作函数的编写
- Jquery easyui从零单排之datagrid数据绑定
- (一)tiny4412开发板硬件资源
- ODPS MapReduce
- Fragment
- 百宝云常用运算符教程
- 【SSH快速进阶】——Hibernate一对一映射(one-to-one)——主键关联映射
- mybatis foreach使用
- PAT 1022 D进制的A+B