fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct A
  5. {
  6. int ele[ 3 ]{ 1, 2, 3 };
  7. };
  8.  
  9. auto f( auto a )
  10. {
  11. for( auto i = 0; i < 3; ++i )
  12. {
  13. cout << a.ele[ i ] << " ";
  14. }
  15. cout << endl;
  16. }
  17.  
  18. int main() {
  19.  
  20. A a;
  21. a.ele[ 2 ] = 9;
  22. A b;
  23. A c = a;
  24.  
  25. f( a );
  26. f( b );
  27. f( c );
  28. c = b;
  29. f( c );
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5532KB
stdin
Standard input is empty
stdout
1 2 9 
1 2 3 
1 2 9 
1 2 3