strcpy和memcpy函数的实现
2013-04-07 21:26
295 查看
strcpy函数的原型为:char *strcpy(char *strDest,const char *strSrc) char *strcpy(char *strDest,const char *strSrc) { assert((strDest != NULL) && (strSrc != NULL)); char *address = strDest; while((*strDest++ = *strSrc++) != '\0') return 0; retrun address; } memcpy函数原型:char *memcpy(char *to, const char *from, size_t size) char *memcpy(char *to, const char *from, size_t size) { assert((to != NULL) && (from != NULL)); //防止to和from的地址发生改变 char *pto = to; char *pfrom = from ; while(size-- > 0) { *pto++ = *from++; } return pto; }
相关文章推荐
- 自我实现strcpy,memcpy函数
- strcpy和memcpy函数的实现
- 不用库函数,自己实现strcpy和memcpy函数
- 不用库函数,自己实现strcpy和memcpy函数;二者的区别
- 自我实现strcpy,memcpy函数
- (C++面试题)请实现strcpy、memcpy函数
- strcpy和memcpy函数的实现及其区别
- strcpy、memcpy函数的实现
- 编程实现strcpy和memcpy函数
- 面试中长间的strcpy、字符串整形相互转换、memcpy函数的实现
- C语言中strlen、strcpy、strncpy、strcat、strnact、strcmp、memcpy函数的实现
- C语言中strcpy与memcpy函数实现与区别
- 【19】实现strcpy和memcpy函数
- strcpy,memcpy函数的实现
- C中strcpy与memcpy函数实现与区别
- C语言中strlen、strcpy、strncpy、strcat、strnact、strcmp、memcpy函数的实现
- C语言:字符串函数(strcpy,memcpy等)模拟实现
- [转]strcpy()、memcpy()、memmove()、memset()的实现
- 转载:函数实现-memcpy-strcpy-memmove-memset
- 字符串函数模拟实现之strcpy、strncpy、strcmp、strncmp、strcat、strncat