fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. static string sHello("Hello");
  5. static string sKdok("kdok123");
  6.  
  7. void tell(string* str2) {
  8. str2 = &sKdok;
  9. }
  10.  
  11. void tellByRef(string* &str3) {
  12. str3 = &sKdok;
  13. }
  14.  
  15. int main() {
  16. string* str1 = &sHello;
  17. cout << *str1 << endl;
  18. tell(str1);
  19. cout << *str1 << endl;
  20. tellByRef(str1);
  21. cout << *str1 << endl;
  22.  
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
Hello
Hello
kdok123