0
#include <iostream>
#include <conio>
using namespace std;

int main()
{
  int MyArray[ 3 ] = { 12, 23, 34 }; //Note 1
 
   int* ptrMyArray = MyArray;	        //Note 2
 
   int* ptrMyArray2 = &MyArray[ 0 ];  //Note 3
 
   int* ptrMyArray3 = &MyArray[ 0 ];  //Note 4
 
   for ( int i = 0; i < 3; i++ )	   //Note 5
   {
      cout << *ptrMyArray;		   //Note 6
      ptrMyArray = ptrMyArray + 1;	   //Note 7
      cout<<endl;
   }

   getch();

   for ( int i = 0; i < 3; i++ )
    {
     cout << *ptrMyArray2;		//Note 9
     ptrMyArray2++;			//Note 10
     cout<<endl;
    }
     getch();		   //Note 11 What is output?

  ptrMyArray = ptrMyArray  1;
  cout << *ptrMyArray << endl;
  getch();            //Note 12 What is output?

  cout << *ptrMyArray2 << endl;
  getch();            //Note 13 What is output?

  cout << *ptrMyArray3 + 2 << endl;
  getch();             //Note 14 What is output?

  ptrMyArray3 = ptrMyArray3 + 2;	//Note 15
 
  cout << *ptrMyArray3 + 2;
  getch();		        //Note 17 What is output?
 
  cout << endl << sizeof( ptrMyArray );
  getch();		        //Note 17 What is output?




   return 0;
}

Edited by WaltP: Added CODE Tags

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by thomas_naveen
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.