通过对MSDN进行查询得知
故函数如下;
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
unsigned int Mystrlen(const char *string)
{
assret(string != NULL);//断言
int count = 0;
while (*string != '\0')
{
count++;
string++;
}
return count;
}
int main()
{
char* str = "belongAL";
int len = Mystrlen(str);
printf("%d\n", len);
system("pause");
return 0;
}