C++ (Allegro Library) Bitmap Two-Dimensional Array Question -
i have quick question. using c++ allegro library.
if make following declaration bitmap* blocks[600][14];, going wasted space if occasionally using 14 of second dimension or space used when declare part of array?
for example:
bitmap* blocks[600][14]; blocks[0][0] = load_bitmap("brick.bmp", null); blocks[1][0] = load_bitmap("brick2.bmp", null); am 'wasting' space not using blocks[0][1], blocks[0][2] etc.?
thanks,
will.
in c++, arrays contiguous yes, 'wasting' additional elements if don't use them.
however, wasting single pointer (8 bytes on 64-bit machine); not actual bitmap data. if use 1 bitmap* element in 600x14 array you're wasting ~67kb; isn't massive amount in modern desktop machine.
Comments
Post a Comment