c语言中的字符串函数有如下这些
- 获取字符串长度
- strlen
- 长度不受限制的字符串函数
- strcpy
- strcat
- strcmp
- 长度受限制的字符串函数
- strncpy
- strncat
- strncmp
- 字符串查找
- strstr
- strtok
- 错误信息报告
- strerror
接下来看看如何实现它们
获取字符串长度
strlen
我们看看文档是怎样说的,如下
size_t strlen ( const char * str );get string length
获取字符串长度
returns the length of the c string str.
返回c字符串str的长度
the length of a c string is determined by the terminating null-character: a c string is as long as the number of characters between the beginning of the string and the terminating null character (without including the terminating null character itself).
c字符串长度是由’