Take an int array of size 5 with different integer values. Now refer the pointer to array and then use increment and decrement operators on pointer to display contents of array ?

#include<iostream>
using namespace std;

int main()
{
const int size =5;
int arr[size]={9,2,3,4,5};
int *ptr;

ptr=arr;

for(int i=0;i<size;i++)
{
cout << *ptr << endl;
ptr++;
}

return 0;
}