In this post, we will see C++ Pointer To Array | Pointer To Array in CPP
Program Code: (pointers8.cpp)
//Array of Pointers
#include<iostream>
using namespace std;
int main()
{
int *p[5];
//int a=1,b=3,c=2,d=7,e=6;
int arr[5]={1,3,2,7,6};
// p[0]=&a;
// p[1]=&b;
// p[2]=&c;
// p[3]=&d;
// p[4]=&e;
for(int i=0;i<5;i++)
{
p[i]=&arr[i];
}
for(int i=0;i<5;i++)
{
cout<<"Value="<<*p[i]<<endl;
}
}
Watch following video:
Watch on YouTube: https://www.youtube.com/watch?v=Xltt1Ba-hyA
No comments:
Post a Comment