#include<iostream.h>
#include<conio.h>
void main()
{
                int a[5],*ptr;
                int (*ap)[5];
                clrscr();
                ptr=a;    //Initilization of Simple Pointer
                ap=&a; //Initilization of Array Pointer
                cout<<"Value of ptr = "<<(unsigned)ptr<<endl;
                cout<<"Value of ap = "<<(unsigned)ap<<endl;
                ptr++;   //Increment By Base Type of Array
                ap++;    //Increment By Size*Base Type of Array
                cout<<"\n\tAfter Incrementation : \n"<<endl;
                cout<<"Value of ptr = "<<(unsigned)ptr<<endl;
                cout<<"Value of ap = "<<(unsigned)ap<<endl;
                cout<<"Size of ptr = "<<sizeof(*ptr)<<endl;
                cout<<"Size of ap = "<<sizeof(*ap)<<endl;
                getch();
}

111.PNG

Advertisements