strcat的实现
#include <iostream>
#include <assert.h>
using namespace std;
/*
字符串的拼接
*/
char *str_cat(char *des, const char* src){
assert((des!=NULL)&&(src!=NULL));//在开始之前先保证des,src2个地址是有效的
char *temp = des;
while(*des!='\0') des++;
while ((*des++ = *src++)!='\0');
return temp;
}
int main(int argc, const char * argv[]) {
// insert code here...
char name[20] = "scott";
const char* last = "xiong";
cout<< str_cat(name, last)<<endl; //scottxiong
return 0;
}