标签:c
#include<stdio.h> void my_strcpy(char* dest,const char* str) { if(NULL != dest || NULL != str) { while(((*dest++) = (*str++)))//注意运算的优先级 { ; } } *dest = '\0'; } int main() { char a[] = "abc"; char b[] = "def"; my_strcpy(a,b); printf("%s\n",a); //printf("%s\n",my_strcpy(a,b));错误的用法,先调用再输出 //printf("%s\n",my_strcpy("abc", "def")); return 0; }
标签:c
原文地址:http://blog.csdn.net/cherry_ermao/article/details/44962273