strcpy库函数的实现细节
#include <stdio.h>
#include <assert.h>
int strlen1(const char* src)
{
assert(NULL!=src);
int len = 0;
while(*src++!='\0')
len++;
return len;
}
int strlen2(const char *src)
{
assert(NULL!= src);
const char *temp = src;
while(*src++!='\0');
return (src-temp -1);
}
int main()
{
char p[] = "Hello world!";
printf("%d\n",strlen1(p)); //12
printf("%d\n",strlen2(p)): //12
return 0;
}