

Pointers and Array

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>

void main() 
    int *array[3];
    int x = 15, y = 25, z = 35;
    int i;
    array[0] = &x;
    array[1] = &y;
    array[2] = &z;
        printf("The value of %d= %d and address is %u\n", i, *(array[i]), array[i]);
Output :
The value of 0= 15 and address is 3487275484
The value of 1= 25 and address is 3487275480
The value of 2= 35 and address is 3487275476

Previous Next