#include <stdio.h>
int strlen(const char* s){
if( s == NULL )
{
return -1;
}
else if( *s == '\0' )
{
return 0;
}else{
return strlen(s+1)+1;
}
}
int main()
{
printf("strlen(\"12345\") = %d\n", strlen("12345"));
getchar();
return 0;
}
转载于:https://blog.51cto.com/2853725/1390963