#include<stdio.h>
#include<assert.h>
size_t strlen(const char *s){
//字符串长度
assert(s != NULL);
unsigned int cnt = 0;
while(*s++){
cnt++;}
return cnt;
}
char * strcpy(char *dest,const char *src){
//字符串复制
assert(dest != NULL && src != NULL);
char *p = dest;
while(*dest++ = *src++){
}//先赋值后判断是否为0后++
return p;
}
char *strncpy(char *dest,const char
C语言str类型处理函数复写(笔试)
最新推荐文章于 2024-03-20 22:08:03 发布