# array of pointer

array of pointer based on two different concept of C++, are follows

The collection of pointer is called array of pointer. In other words, the array of pointer is the collection of address, which contains the array of element stores. Thus each element of the array is a pointer.

while, access these address’s value, we use *ptr[0]*ptr[1],*ptr[2],*ptr[3] in same order.

## Declaration of array of pointer

SYNTEX:

`Data type *array_name[size];`

Example:

```int *ptr[6];

int arr[6] = {3,2,4,3,1,6};```

As we know, we can access an array element from index value i.e.

```cout<<*ptr[0] ; //3
cout<<*ptr[1]; //2
cout<<*ptr[2]; //4
cout<<*ptr[3]; //3
cout<<*ptr[4] ; //1
cout<<*ptr[5] ; //6```

```ptr[0] = &arr[0]; ptr[0] में 3 का address,
ptr[1] = &arr[1]; ptr[1] में 2 का address,
ptr[2] = &arr[2]; ptr[2] में 4 का address,
ptr[3] = &arr[3]; ptr[3] में 3 का address,
ptr[4] = &arr[4]; ptr[4] में 1 का address.
ptr[4] = &arr[4]; ptr[4] में 6 का address.```

will be the store.

You can understand this through the program given below-

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

void main()
{
int *ptr[6];
int i,arr[6] = {3,2,4,3,1,6};

clrscr();

for(i= 0; i<5; i++)
{
ptr[i] = &arr[i];     //assigning each element address in ptr[i]

cout<<"address of value "<<arr[i]<<" is "<<ptr[i]<<endl;
}

cout<<"\nvalues of these address are:\n";

for(i= 0; i<5; i++)
{
cout<<*ptr[i]<<" ";          //displaying elements
}
getch();
}```
```OUTPUT:-
address of value 3 is 0x8f2bff8e
address of value 2 is 0x8f2bff90
address of value 4 is 0x8f2bff92
address of value 3 is 0x8f2bff94
address of value 1 is 0x8f2bff96

values of these address are:
3 2 4 3 1```