mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-08 06:55:36 +08:00
34 lines
606 B
HTML
34 lines
606 B
HTML
<h1>字符串函数 - strlen</h1>
|
||
|
||
|
||
<p>原型:extern int strlen(char *s);</p>
|
||
|
||
<p>用法:#include <string.h></p>
|
||
|
||
<p>功能:计算字符串s的长度</p>
|
||
|
||
<p>说明:返回s的长度,不包括结束符NULL。</p>
|
||
|
||
举例:<pre><code class="language-c">
|
||
|
||
|
||
// strlen.c
|
||
|
||
#include <syslib.h>
|
||
#include <string.h>
|
||
|
||
main()
|
||
{
|
||
char *s="Golden Global View";
|
||
|
||
clrscr();
|
||
|
||
printf("%s has %d chars",s,strlen(s));
|
||
|
||
getchar();
|
||
return 0;
|
||
}
|
||
|
||
</code></pre>相关函数:无
|
||
|