自己实现strcpy
#include <iostream> using namespace std; char* mystrcpy(char* dest,const char* src) { if(src==nullptr || dest==nullptr) { return nullptr; } char* addr=dest; while((*dest++=*src++)!='\0'); return dest; } int main(int argc, char *argv[]) { //char p[10]; //char *pp; //mystrcpy(p,"asd"); char a[]="qwe"; char b[]="asd"; mystrcpy(a,b); cout<<a<<endl; return 0; }