strcat函数

 原型:char  *strcat  ( char  *dest, const  char  *src)ios

   用法:#include  <string.h>web

   功能:链接两个字符串;strcat()会将参数src字符串 拷贝到 参数dest所指的字符串尾。 第一个参数dest要有足够的空间来容纳要拷贝的字符串。spa

   说明:strcat()返回dest的字符串起始地址。code

#include<iostream>
using namespace std;
 
int main()
{
    char p1[10] = "abcd", *p2, str[10] = "xyz";
    
    p2 = "ABCD";
    strcpy(str + 2, strcat(p1 + 2, p2 + 1));
    printf(" %s", str);
}

 

答案:xycdBCDorm

相关文章
相关标签/搜索