用C语言编码实现:用指针实现:将字符串" C language programming "拼接到字符串" Our favorite is "的后面。
时间: 2024-05-10 07:19:04 浏览: 61
```c
#include <stdio.h>
#include <string.h>
int main() {
char str1[50] = "Our favorite is ";
char str2[] = "C language programming";
char *ptr1 = str1 + strlen(str1);
char *ptr2 = str2;
while (*ptr2 != '\0') {
*ptr1++ = *ptr2++;
}
*ptr1 = '\0';
printf("%s\n", str1);
return 0;
}
```
输出结果:
```
Our favorite is C language programming
```
阅读全文