C Program to Display Array of Pointers

In this program, you will learn to display array elements using array of pointers. “Array of pointers” is an array of the pointer variables. It is also known as pointer arrays. Syntax: int *var_name[array_size]; We can make separate pointer variables which can point to the different values or we can make one integer array of pointers that can point to all the values.



Source Code
# include<stdio.h>
void main()
{
    int *arr[4];
    int i=31, j=5, k=19, l=71, m;
    arr[0] = &i;
    arr[1] = &j;
    arr[2] = &k;
    arr[3] = &l;
    for (m=0; m<=3; m++)
        printf("%d\n", *(arr[m]));
    getch();
}
Output
31
5
19
71





"Coding Hub - Learn to code" app now available on Google Play Store