Declare a single-dimensional array - C Array

C examples for Array:Array Element

Description

Declare a single-dimensional array

Demo Code

#include <stdio.h>

int main( void ){
   int elements[10];
   //w  w  w . ja  v  a2  s  .  c om
   for (int idx = 0; idx < 10; idx++)
      elements[idx] = idx ;

   for (int idx = 0; idx < 10; idx++)
      printf( "\nelements[%d] = %d ", idx, elements[idx] );

   return 0;
}

Result


Related Tutorials