函数题:字符串拼接 - C/C++ 指针及引用
函数strAppend(d,s)将以0结尾的字符串s附加到以0结尾的字符串d之后。请实现该函数,使得后续程序可以正确运行。请注意为目标字符串分配足够的内存空间,以免溢出。注意不能使用原生的strcat()函数。
示例:指针d所指向的字符串"hello"在附加字符串"world"后变为"helloworld"。
### 函数接口定义:
c++
void strAppend(char *d, const char* s);
### 裁判测试程序样例:
c++
#include <stdio.h>
//在此处定义strAppend()函数
int main()
{
char s1[1024];
char s2[1024];
gets(s1);
gets(s2);
strAppend(s1,s2);
printf("%s",s1);
return 0;
}
### 输入样例:
in
hello
world
### 输出样例:
out
helloworld
请注意:函数题只需要提交相关函数的定义代码,不要提交完整程序。
### 感觉不会? 那试着听听**免费的B站网课**
[简洁的C和C++ - 重庆大学在线课程](https://www.bilibili.com/video/BV1it411d7zx/)
[Python编程基础及应用 - 重庆大学在线课程](https://www.bilibili.com/video/BV1kt411R7uW/)

答案:若无答案欢迎评论
示例:指针d所指向的字符串"hello"在附加字符串"world"后变为"helloworld"。
### 函数接口定义:
c++
void strAppend(char *d, const char* s);
### 裁判测试程序样例:
c++
#include <stdio.h>
//在此处定义strAppend()函数
int main()
{
char s1[1024];
char s2[1024];
gets(s1);
gets(s2);
strAppend(s1,s2);
printf("%s",s1);
return 0;
}
### 输入样例:
in
hello
world
### 输出样例:
out
helloworld
请注意:函数题只需要提交相关函数的定义代码,不要提交完整程序。
### 感觉不会? 那试着听听**免费的B站网课**
[简洁的C和C++ - 重庆大学在线课程](https://www.bilibili.com/video/BV1it411d7zx/)
[Python编程基础及应用 - 重庆大学在线课程](https://www.bilibili.com/video/BV1kt411R7uW/)

答案:若无答案欢迎评论