C语言中用什么函数可以得到一个字符串的长度?

RT

c语言中获得一个字符串长度的函数是:strlen(),举例如下:

#include<stdio.h>
#include<string.h>
main()
(
char *str="this is a test msg";
printf("%d\n",strlen(str));
getch();
)
温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-06-13
int cont_str(char*s)
{
int i=0;
while(str[i++]!='\0');
return i;
}
第2个回答  推荐于2017-09-15
#include <string.h>

int strlen(a);
返回字符串长度本回答被提问者采纳
相似回答