指针习题(2):编写字符串连接函数strcat()
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |
Description
编写函数实现字符串连接函数strcat( )的功能。
Input
输入仅一行输入两个字符串。
Output
输出仅一行输出连接后的一个字符串。
Sample Input
abc defgh
Sample Output
abcdefgh
Source
#include <stdio.h>
int main()
{
char a[20],b[20];
scanf("%s%s",a,b);
int i,j;
i=0;
while (a[i])
{
i++;
}
j=0;
while (b[j])
{
a[i]=b[j];
i++;
j++;
}
a[i]='\0';
printf("%s",a);
system("pause");
return 0;
}