我想找到一种方法来查找
这是我的方法:
C
中任何字符串的长度。
这是我的方法:
#include <stdio.h>
int main()
{
char s[10] = "hello";
int i , len = 0;
for(i = 0; s[i] != '\0'; i++)
{
len++
}
printf("length of string is: %d" , len);
return 0;
}
我想找到一种方法,只需要一行代码就能获得字符串的长度。
strlen
是一行代码 - StoryTeller - Unslander Monicastrlen
函数可能会使用矢量指令进行优化,例如SSE4.2,就像这里所示:https://searchcode.com/codesearch/view/38004910/ - Zan Lynx