C Program to Access Elements of an Array Using Pointer



 c program to access elements of an array using pointer

Learn C - C tutorial - c program to access elements of an array using pointer - C examples - C programs

C Program to Access Elements of an Array Using Pointer

  • Array that can store a fixed-size sequential elements of the same type.
  • An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.

Sample Code

#include <stdio.h>
int main()
{
    int data[5]= {5,8,9,7,3}, i;
    printf("Enter elements:{5,8,9,7,3} \n");
    printf("You entered: \n");
    for(i=0; i<5; ++i)
        printf("%d\n", *(data + i));
    return 0;
}

Output

Enter elements:{5,8,9,7,3} 
You entered: 
5
8
9
7
3


View More Quick Examples


Related Searches to C Program to Access Elements of an Array Using Pointer