#include <iostream>
#include <Windows.h>
#include <string>
#include <stdio.h>
using namespace std;
int main(void)
{
string a="hello!";
string b="world";
string s="";
s=a+b; //连接两个字符串到s
char *c=new char[s.length()]; //动态分配
for(int i=0;i<s.length();i++)
{
*(c+i)=s[i];
}
for(int i=0;i<s.length();i++)
{
cout<<*(c+i);
}
delete[] c;
system("pause");
return 0;
}
10-10
249
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)