标签:amp null ++ std using col ret mes out
#include <iostream> #include <stdio.h> using namespace std; char *_strcpy(char* des, char* src) { if (des == NULL || src == NULL) { return 0; } // cout << (void*)des << endl; // cout << src << endl; // cout << *des << endl; // cout << *src << endl; int ret = 0; char* temp1 = des; char* temp2 = src; while (!(ret=*temp1 -*temp2) && *temp1) { temp1++; temp2++; } if (ret == 0) { return 0; } char* pIter = des; while ((*pIter++ = *src++) != ‘\0‘); return des; } int main() { char a[] = "abc"; char b[] = "abc4"; char *c = _strcpy(a, b); return 0; }
标签:amp null ++ std using col ret mes out
原文地址:https://www.cnblogs.com/strive-sun/p/12519146.html