fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. void t_ptr(string *str)
  6. {
  7. cout << "t_ptr " << *str << endl;
  8. }
  9.  
  10. void t_ref(string &str)
  11. {
  12. cout << "t_ref " << str << endl;
  13. }
  14.  
  15. int main() {
  16. string *p_str = new string("test");
  17. t_ptr(p_str);
  18. t_ref(*p_str);
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
t_ptr test
t_ref test