注意点:
1)有效性判断
2)边界值,考虑到最后的'\0'
#include <iostream>
using namespace std;
void strcopy(char *src,char *des)
{
if((NULL == src) || (NULL == des))
return;
while(*src!='\0')
{
*des = *src;
des++;
src++;
}
*des = '\0';
}
注意点:
1)有效性判断
2)边界值,考虑到最后的'\0'
#include <iostream>
using namespace std;
void strcopy(char *src,char *des)
{
if((NULL == src) || (NULL == des))
return;
while(*src!='\0')
{
*des = *src;
des++;
src++;
}
*des = '\0';
}