char *my_strcpy(char *destination ,const char *source)
{
assert(destination !=NULL && source !=NULL);
char *target=destination;
while(*destination++=*source++);
return target;
}
//C/C++ 中的 assert 是一个宏,用于在运行时检查一个条件是否为真
//如果条件不满足,则运行时将终止程序的执行并输出一条错误信息。
//assert 宏定义在 <assert.h> 或 <cassert> 头文件中,并接受一个参数,通常为一个语句。
实现strcpy函数
最新推荐文章于 2024-07-20 22:49:13 发布