Here is a C++ program to illustrate array of pointers to integers
SOURCE CODE OUTPUT
#include<iostream>
using namespace std;
int main()
{
int m=10,n=20,o=30,p=40,q=50;
int *x[5]={&m,&n,&o,&p,&q};
for(int i=0;i<5;i++)
cout<<"Address : "<<unsigned(x[i])<<" Value : "<<*x[i]<<endl;
return 0;
}
using namespace std;
int main()
{
int m=10,n=20,o=30,p=40,q=50;
int *x[5]={&m,&n,&o,&p,&q};
for(int i=0;i<5;i++)
cout<<"Address : "<<unsigned(x[i])<<" Value : "<<*x[i]<<endl;
return 0;
}
Any questions regarding to program please write in comments.
No comments:
Post a Comment