H
Henry
I finally thought I had an understanding of multi dimensional arrays in C
when I get this:
#include <stdio.h>
#define max_x 3
#define max_y 5
int array[max_x][max_y];
main()
{
int x,y;
for(x = 0; x < max_x; x++)
for(y=0; y < max_y; y++)
array[x][y] = x * 10 + y;
for(y = 0; y < max_y; y++) {
(void)printf("array[%d] ", y);
for(x = 0; x < max_x; x++)
(void)printf("%d ", array[x,y]);
(void)printf("\n");
}
return 0;
}
This program initializes to :
array[0] 56164 56164 56164
array[1] 56184 56184 56184
array[2] 56204 56204 56204
array[3] 56224 56224 56224
array[4] 56244 56244 56244
Could someone please help me figure out how this program arrives at such a
large number?
when I get this:
#include <stdio.h>
#define max_x 3
#define max_y 5
int array[max_x][max_y];
main()
{
int x,y;
for(x = 0; x < max_x; x++)
for(y=0; y < max_y; y++)
array[x][y] = x * 10 + y;
for(y = 0; y < max_y; y++) {
(void)printf("array[%d] ", y);
for(x = 0; x < max_x; x++)
(void)printf("%d ", array[x,y]);
(void)printf("\n");
}
return 0;
}
This program initializes to :
array[0] 56164 56164 56164
array[1] 56184 56184 56184
array[2] 56204 56204 56204
array[3] 56224 56224 56224
array[4] 56244 56244 56244
Could someone please help me figure out how this program arrives at such a
large number?