fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int arr[3] = {0,1,2};
  6.  
  7. cout << "arr[0] = " << arr[0] << endl;
  8. cout << "arr[1] = " << arr[1] << endl;
  9. cout << "arr[2] = " << arr[2] << endl << endl;
  10.  
  11. int *first = &arr[0];
  12. *first = 5;
  13.  
  14. int &second = arr[1];
  15. second = 10;
  16.  
  17. int third = arr[2];
  18. third = 15;
  19.  
  20. cout << "arr[0] = " << arr[0] << endl;
  21. cout << "arr[1] = " << arr[1] << endl;
  22. cout << "arr[2] = " << arr[2] << endl;
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
arr[0] = 0
arr[1] = 1
arr[2] = 2

arr[0] = 5
arr[1] = 10
arr[2] = 2