自定义函数复制字符串

#include< iostream>
using namespace std;
char * strcy(char *dest, char *s)
{
int i = 0;
while (s[i] != ‘\0’)
{
// dest[i] = s[i];
*(dest + i) = *(s+i);
i++;
}
dest[i] = ‘\0’;
return dest;
}
void main()
{
char *p=“aksdkkd s”;
char s[100];
cout << strcy(s, p) << endl;
}在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_42384570/article/details/83145093