c++字符串函数

来源:互联网 发布:php 探针 不支持mssql 编辑:程序博客网 时间:2024/06/16 10:05

1.字符串拷贝函数strcat

char *strcpy(char *str1, char *str2) ------ 返回str1的地址值

2.字符串连接函数strcat

char *strcat(char *str1,char *str2)  ----- 返回str1的地址值


#include <iostream>
#include<string.h>
using namespace std;

int main(int argc, char** argv) {
     char p1[15]= "abcd",*p2= "ABCD", str[50]= "xyz";
     cout<<strcat(p1+2,p2+2)<<endl;
     cout<<strcpy(str+2,p1)<<endl;
     cout<<str<<endl;
     return 0;
}




原创粉丝点击