Wondered how you can see the Different values of Pointers pointing to array here is a simple program.

Program to print different values being pointing to by an array of pointers


////////////////////////////////Tested By C++ and Created////////////////////////////////


#include <iostream.h>
#include <conio.h>

void main()

{ clrscr();

int *ip[5];                              ///////Array of 5 int Pionters///

int f=65,s=67,t=69,fo=70,fi=75;          ////// 5 int variables////////

ip[0]=&f;      ip[1]=&s;   ip[2]=&t;

ip[3]=&fo;     ip[4]=&fi;

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

cout<<"\tThe Program Prints diff. Values pointing by an array\n";

cout<<"\n\nThe pointer ip["<<i<<"]points to "<<*ip[i]<<"\n";

cout<<"The base address stored in the array ip of pointers is "<<ip<<"\n";

for(i=0;i<5;i++)

cout<<"The address stored is ip["<<i<<"]is"<<ip[i]<<"\n";

getch();

}

Designed By Blogger Templates | Templatelib & Distributed By Blogspot Templates