lzth.net
当前位置:首页 >> 请教C语言高手mystrCpy,mystrCAt,mystrCmp的最简洁... >>

请教C语言高手mystrCpy,mystrCAt,mystrCmp的最简洁...

//大概这样 #include int mystrcmp(const char *left,const char *right) { const char *p=left; const char *q=right; while(*p!='\0'&&*q!='\0'&&*p==*q) { p++;q++; } if(*p=='\0'&&*q=='\0') return 0; return *p-*q; } char *mystrcat(char...

代码参考: #include #include #include void mystrcpy(char *to, const char *from){ assert((to != NULL) && (from != NULL)); while ((*to++ = *from++) != '\0'); *to = '\0'; } void mystrcat(char *str1, const char *str2){ assert((str1...

网站首页 | 网站地图
All rights reserved Powered by www.lzth.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com