1 #include <iostream> 2 #include <iomanip> 3 #include <string> 4 using namespace std; 5 double power(double x,int n); 6 char * mycopy(char *dest, const char * src) 7 { 8 if(src == NULL || dest ==NULL) 9 return NULL; 10 if(src == dest) 11 return NULL; 12 char *temp = dest; 13 cout << "src = " << src << endl; 14 while((*dest++ = *src++)!= '/0'){} 15 16 cout <<"temp = "<<temp<<endl; 17 18 return temp; 19 } 20 21 int main() 22 { 23 cout <<"hello"<<endl; 24 25 char src[10] = "wfg"; 26 char dest[10]; 27 mycopy(dest,src); 28 cout << "dest = "<< dest <<endl; 29 return 0; 30 31 }
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/288770.html