#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;
}
kokiwi 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
thomas_naveen 105 Junior Poster
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.