C Array Class Example - C

What is array in C and how to use it?

Snippet Code


  
Rate this page :
  [ 0 votes]

This simple code allows you to store group of elements as same data type in an array. Here,arr[10] is the array variable which stores 10 integer numbers. The sample c code is given below.

#include <stdio.h> int main () { int arr[ 10 ]; int i,j; for ( i = 0; i < 10; i++ ) { arr[ i ] = i + 10; } for (j = 0; j < 10; j++ ) { printf("Array[%d] = %dn", j, arr[j] ); } return 0; }

Tags


Ask Questions

Ask Question