fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int* ptr;
  7. int a[5]={20,30,40,50,60};
  8. ptr=&a[0];
  9. for (int i=0; i<4; i++)
  10. { *ptr=*ptr+1;
  11. ptr++;
  12. }
  13. for (int i=4; i>=0; i--)
  14. cout<<a[i]<<endl;
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
60
51
41
31
21