统计字符串的长度

实战:字符串有多长

#include <stdio.h>
int main()
{
    char str[50];
    printf("input the string:");
    gets(str);
    int n=0;
    while(str[n]!='\0')
    {
        n++;
    }
    printf("there are %d string.\n",n);
    return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_41211961/article/details/84062156