linux系统库函数之strlen

来源:互联网 发布:移动pos机利润数据 编辑:程序博客网 时间:2024/05/16 09:42
370 #ifndef __HAVE_ARCH_STRLEN
371 /**
372  * strlen - Find the length of a string
373  * @s: The string to be sized
374  */
375 size_t strlen(const char *s)
376 {
377         const char *sc;
378 
379         for (sc = s; *sc != '\0'; ++sc)
380                 /* nothing */;
381         return sc - s;
382 }
383 EXPORT_SYMBOL(strlen);

384 #endif

计算字符串的长度,不包括字符串的结束符'\0'。

原创粉丝点击