C 库函数 - strlen()
C 语言教程
· 2019-02-24 16:27:22
描述
C 库函数 size_t strlen(const char *str) 计算字符串 str 的长度,直到空结束字符,但不包括空结束字符。
声明
下面是 strlen() 函数的声明。
size_t strlen(const char *str)
参数
- str -- 要计算长度的字符串。
返回值
该函数返回字符串的长度。
实例
下面的实例演示了 strlen() 函数的用法。
#include <stdio.h>
#include <string.h>
int main ()
{
char str[50];
int len;
strcpy(str, "This is codercto.com");
len = strlen(str);
printf("|%s| 的长度是 |%d|\n", str, len);
return(0);
}
让我们编译并运行上面的程序,这将产生以下结果:
|This is codercto.com| 的长度是 |18|
点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html
Python编程实战
[美] Mark Summerfield / 爱飞翔 / 机械工业出版社 / 2014-8 / 69.00元
《python编程实战:运用设计模式、并发和程序库创建高质量程序》由python开发者社区知名技术专家mark summerfield亲笔撰写,全球资深python专家doug hellmann作序鼎力推荐,是python领域最有影响力的著作之一。书中通过大量实用的范例代码和三个完整的案例研究,全面而系统地讲解了如何运用设计模式来规划代码结构,如何通过并发与cython等技术提升代码执行速度,以及......一起来看看 《Python编程实战》 这本书的介绍吧!