initial import
[staff/goc4/2018bti7061.git] / c-3-libraries / examples / c-arrays / array2.c
1 #include <stdio.h>
2
3 int main (){
4 /* an array with 5 rows and 2 columns*/
5 int a[5][2] = { {0,0}, {1,2}, {2,4}, {3,6},{4,8}};
6 int i, j;
7
8 /* output each array element's value */
9 for ( i = 0; i < 5; i++ )
10 {
11 for ( j = 0; j < 2; j++ )
12 {
13 printf("a[%d][%d] = %d\n", i,j, a[i][j] );
14 }
15 }
16 return 0;
17 }
18
19 /* Output:
20 a[0][0] = 0
21 a[0][1] = 0
22 a[1][0] = 1
23 a[1][1] = 2
24 a[2][0] = 2
25 a[2][1] = 4
26 a[3][0] = 3
27 a[3][1] = 6
28 a[4][0] = 4
29 a[4][1] = 8
30 */