D
desktop
I am simulating a display that consists of 20x20 pixels. All pixels are
per default white but I would like to be able to turn on some or all the
pixels.
My idea was to create a 3 dimensional array:
in a[][][]
where the first index is the potential numbers of pixels that I would
like to paint (20x20). The following two index should be the coordinates
for the pixels that should be painted. If I want to paint 3 pixels
(2,4), (17,9), (10,3) the following should be made:
a[0][2][4];
a[1][17][9];
a[2][10][3];
But when I declare a 3-dim array:
a[][][];
I get:
error: declaration of ‘a’ as multidimensional array must have bounds for
all dimensions except the first
I have then tried:
a[20*20][20*20][20*20];
But is there not some way to accomplish my above 3 pixels without making
such a huge array?
per default white but I would like to be able to turn on some or all the
pixels.
My idea was to create a 3 dimensional array:
in a[][][]
where the first index is the potential numbers of pixels that I would
like to paint (20x20). The following two index should be the coordinates
for the pixels that should be painted. If I want to paint 3 pixels
(2,4), (17,9), (10,3) the following should be made:
a[0][2][4];
a[1][17][9];
a[2][10][3];
But when I declare a 3-dim array:
a[][][];
I get:
error: declaration of ‘a’ as multidimensional array must have bounds for
all dimensions except the first
I have then tried:
a[20*20][20*20][20*20];
But is there not some way to accomplish my above 3 pixels without making
such a huge array?