Array of Pointer


Array is a collection of variables of same data type. Thus array is used to store more then values of same data types.
Similarly array of pointer is a collection of addresses. This contains addresses of more then one variables of same data types inside it.

     

#include <stdio.h>
#include <conio.h>
void main() 
{
clrscr ();
int *array[3];
int x = 15, y = 25, z = 35;
int i;
array[0] = &x;
array[1] = &y;
array[2] = &z;
for (i=0; i< 3; i++) 
{
printf("The value of %d= %d and address is %u\n", i, *(array[i]), array[i]);
}
getch();
}
Output:
The value of 0 = 15 and address is 55248
The value of 1 = 25 and address is 55250
The value of 2 = 35 and address is 5525

Download Projects


Download Programs