#include<string>
#include<iostream>

using namespace std;

string fun1(int a)
{

string str = "a";
return str;
}

char* fun2(int a)
{
char *p = new char[2];
p[0] = 'a';
p[1] = '\0';
return p;
}

void main()
{

cout<<fun1(4)<<endl;

char *p = fun2(4);
cout<<p<<endl;
delete [] p;
}

 

相关文章:

  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
  • 2021-06-03
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-01
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
  • 2021-12-18
相关资源
相似解决方案