本帖最后由 王鹏 于 2015-6-29 20:56 编辑
#include <stdio.h> #include <string.h> void strcpy1(char arr1[],char arr2[]){ int i=0; while (arr2!='\0') { char *p1=&arr1, *p2=&arr2; *p1=*p2; i++; } }
int main(int argc, const char * argv[]) { char arr1[]="abc"; char arr2[]="def"; puts(arr1); puts(arr2); printf("----------\n"); //strcpy(arr1, arr2); strcpy1(arr1, arr2); puts(arr1); puts(arr2); return 0; }
|