码迷,mamicode.com
首页 > 其他好文 > 详细

c常用函数-strlen

时间:2020-04-03 15:12:44      阅读:70      评论:0      收藏:0      [点我收藏+]

标签:ESS   col   字符   test   lin   长度   遇到   return   sign   

strlen

返回字符串长度

Action()
{    
    char test[] = "yyyHHHJJJoo";
    unsigned int a;
    a = strlen(test);
    lr_output_message("%d",a);
    return 0;
}

 

在计算字符串长度时, strlen一旦遇到“\0"就会认为字符串已经结束。因此, "This is a test!"与"This is a test!\0abcde"的长度是一样的。

c常用函数-strlen

标签:ESS   col   字符   test   lin   长度   遇到   return   sign   

原文地址:https://www.cnblogs.com/lvchengda/p/12626497.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!