Bootstrap

C语言 字符串的链接

//字符串连接
#include <stdio.h>
#include <string.h>
int main()
{
char str1[256];
char str2[256];
char dst[512];

printf("请输入两个字符串:\n");
gets(str1);
gets(str2);

char* pSrc = str1;
char* pDst = dst;
while (*pSrc !=	 '\0') *pDst++ = *pSrc++;

pSrc = str2;
while (*pSrc != '\0') *pDst++ = *pSrc++;
*pDst = '\0';
printf("连接后的字符串=");
puts(dst);
return 0;

}

;