Retrieve Data from a one-dimensional Array Using the Array Name and dereferencing operator * - C Pointer

C examples for Pointer:Array Pointer

Description

Retrieve Data from a one-dimensional Array Using the Array Name and dereferencing operator *

Demo Code

#include <stdio.h>

int main()/*from  w  ww. j  a v a2s. com*/
{
     int marks [] = {1, 2, 3, 4, 5};
     printf("Values stored in array elements.\n");
     for (int i = 0; i < 5; i++)
         printf("Element no. %d, value: %d\n", i+1, *(marks+i));
    
     printf("\nValue of array-name marks: %u\n\n", marks);
    
     printf("Addresses of array elements:\n");
     for (int i = 0; i < 5; i++)
         printf("Address of element marks[%d] : %u\n", i, &marks[i]);
     return(0);
}

Related Tutorials