fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. auto foo(auto c, auto i) -> auto&
  6. {
  7. return c[i];
  8. }
  9.  
  10.  
  11. int main()
  12. {
  13. int arr[10] = {0};
  14.  
  15. std::cout << foo(arr, 1) << std::endl;
  16.  
  17. foo(arr, 1) = 2;
  18.  
  19. std::cout << foo(arr, 1) << std::endl;
  20. // your code goes here
  21. return 0;
  22. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
0
2