不使用库函数,求一个字符串长度

/*
编写一个函数,不使用strlen等库函数,求得一个字符串的长度,参数为该字符串,返回值为该字符串的长度。
*/
#include "stdafx.h"
#include"stdlib.h"

int ves1(char num[]) {
    int a = 0, i = 0;
    while (num[i] != '')
    {
        a++;
        i++;
    }
    return a;

}
int main()
{    
    char ch[] = "fs46546";
    int h =ves1(ch);
    printf("字符串长度为:%d", h);
    system("pause");
    return 0;
}
原文地址:https://www.cnblogs.com/Engi-xx/p/6306835.html