Array Pointer 1

Description:

Get the input as an array and display the elements using pointer. Test Case 1 Input (stdin) 5 31 54 77 52 93 Expected Output 31 54 77 52 93 Test Case 2 Input (stdin) 3 45 67 89 Expected Output 45 67 89

Program :

#include <iostream>

using namespace std;

int main()

{

   int data[10],n;

  cin>>n;

   //cout << "Enter elements: ";

   for(int i = 0; i < n; ++i)

      cin >> data[i];

   //cout << "You entered: ";

   for(int i = 0; i < n; ++i)

      cout << endl << *(data + i);

   return 0;

}