14、求一个字符串的长度

/*
求一个字符串的长度
 */

#include <stdio.h>
#include <stdlib.h>

int strLen(char *pStr)
{
    char *p = pStr;
    int Length = 0;
    while(*p != '\0')
    {
        ++ p;
        ++ Length;
    }
    return Length;
}

int main()
{
    char str[100];
    scanf("%s",str);
    printf("%d",strLen(str));
    return 0;
}

posted @ 2021-09-22 21:27  叶梓渔  阅读(148)  评论(0)    收藏  举报