题解 | #获取字符串长度#

获取字符串长度

https://www.nowcoder.com/practice/9a2d212d23f5436c80607d5e68c6d12a

#include<string.h>
#include <stdio.h>
int main()
{
    char str[50]={};
    scanf("%[^\n]",str);
    char*x=str;
    int i=0;
    int n=0;

    while(*x!='\0')
    {

        i++;
        n++;
        x++;

    }
    printf("%d",n);
    return 0;




}

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务