#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;
}

Recommended Answers

All 2 Replies

>>#include <conio>

There is no such file. You probably mean conio.h

And what are all those notes??

The first thing that is wrong with your code is that you have not used code tags while posting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.