LERAN C PROGRAMMING

Learn one of the most powerful programming languages in the world and become a rockstar developer.

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;
    for (i=0; i< 3; i++) 
    {
        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
x
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Privacy Policy That's Fine