C examples for Array:Array Element
Puts random numbers into a two-dimensional array that is 5 by 4. Output the value
#include <stdio.h> #include <stdlib.h> int main( void ){ int array[5][4]; int a, b;/*from w w w . ja va 2s. c o m*/ for ( a = 0; a < 5; a++ ){ for ( b = 0; b < 4; b++ ){ array[a][b] = rand(); } } for ( a = 0; a < 5; a++ ){ for ( b = 0; b < 4; b++ ){ printf( "%d\t", array[a][b] ); } printf( "\n" ); /* go to a new line */ } return 0; }