#include <stdio.h>
int my_strlen(const char* src)
{
int len = 0;
while(*src++ != '\0')
len++;
return len;
}
int main()
{
char arr[] = "Hello C language!";
printf ("len:%d\n", my_strlen(arr));
return 0;
}
运行结果:
#include <stdio.h>
int my_strlen(const char* src)
{
int len = 0;
while(*src++ != '\0')
len++;
return len;
}
int main()
{
char arr[] = "Hello C language!";
printf ("len:%d\n", my_strlen(arr));
return 0;
}
运行结果: