C Program To Print Array
In this section we will learn about initialization of array and print the array element using for loop.
C array example
#include <stdio.h> #include <conio.h> void main( ) { int num[5]; num[0] = 17; num[1] = 38; num[2] = -7; num[3] = 30; num[4] = 12; printf("%d \n",num[0]); //access particular element printf("%d \n",num[4]); getch(); }
Output of program

This is a simple C program to initialize array statically and access the single array element.
C array example
#include <stdio.h> #include <conio.h> void main( ) { int num[5]; int i;//index always starts from 0 num[0] = 17; num[1] = 38; num[2] = -7; num[3] = 30; num[4] = 12; for ( i = 0; i <= 4; i++ ) { printf("num[%i] = %i \n",i,num[i]); } getch(); }
This is a simple c program to access all the element of the array with the help of for loop.
C array example
#include <stdio.h> #include <conio.h> void main( ) { int num[]={12,20,6}; printf("%d \n",num[0]); //access particular element printf("%d \n",num[2]); getch(); }
Download C print array example
You can access the particular element of the array with the help of index number as shown above.