fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void GetString(string *pBuff)
  5. {
  6. std::cout << "Initial string was: " << *pBuff << std::endl << "Changing its value..." << std::endl;
  7. *pBuff = "Hello from C++!";
  8. }
  9.  
  10. int main() {
  11. string *pBuff = new string("blablablablablablabla");
  12. GetString(pBuff);
  13. std::cout << *pBuff;
  14. return 0;
  15. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Initial string was: blablablablablablabla
Changing its value...
Hello from C++!