1、strlen
非递归版本
int strlen(const char *s) { assert(s!=NULL); const char *p=s; while(*p)p++; return p-s; }
递归版本
int strlen(const char *s) { return *s?1+strlen(s+1):0; }
2、strcat
char *strcat(char *s,const char *p) { assert(s!=NULL && p!=NULL); char *q=s; while(*q)q++; while((*q++=*p++)); return s; }
char *strncat(char *s,const char*p,size_t n) { assert(s!=NULL && p!=NULL); char *q=s; while(*q)q++; while(n-- && (*q++=*p++)!='