#include "stdafx.h"


int main(int argc, char* argv[])
{
//string s("hello world");
string s = "hello world";
string *p = &s;
*p = "goodbye";//此时字符串s的值也变化了
string *sp = &s;
sp = p;
*sp = "new another world";//都指向了同一内存地址
cout << s << endl;//s的值为new another world
return 0;
}

相关文章:

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