C++ C++字符串复制函数StrCpy算法设计(二)
#include <iostream> using namespace std; void StrCpy(char pDestination[], char *pSource); void main() { char pString[40]; StrCpy(pString, "ganquanfu2008"); cout << pString << endl; int tem; cin >> tem; } void StrCpy(char pDestination[], char *pSource) { int i= 0; int len = 0; while(pSource[i]!='\0') { i++; len++; } int j = len - 1; while(j >= 0) { pDestination[j] = pSource[j]; j--; } pDestination[len] = '\0'; }