计算字符串长度

像"c:\test\32\test.c"这样一段字符串的长度是多少?我们要数的话需要注意里面的转义字符等等,很容易出错,利用程序则会方便很多

#include <stdio.h>
#include <string.h>
int main()
{
printf("%d\n",strlen("c:\test\32\test.c"));
return 0;
}

 

posted @ 2021-01-14 20:18  qyscc  阅读(102)  评论(0)    收藏  举报