using new to allocate a mult array

Started by
19 comments, last by Metal Typhoon 21 years, 3 months ago
You can also represent multi-dimensional arrays as a 1-dimensional array. Here''s how to do it with a 2-dimensional array:
#define ARRAYCOLS 256#define ARRAYROWS 64int myarray[ARRAYCOLS * ARRAYROWS];/* You can then address item on row R and column C like so: */myarray[(R * ARRAYCOLS) + C] = 55; 

- Andy Oxfeld

This topic is closed to new replies.

Advertisement