Preprocessor Macros Exercises |
< Previous Next > |
#include <iostream> using std::cout; using std::endl; const int NUM_ROWS = 512; const int NUM_COLS = 128; int fastArray[ NUM_ROWS * NUM_COLS]; // simulating a 2D array with a 1D array int main(){ int counter = 0; for( int rowI = 0; rowI <= NUM_ROWS; rowI++){ for( int colI = 0; colI <= NUM_COLS; colI++){ ARRAY( rowI, colI) = counter++; cout << "(" << rowI << ", " << colI << "): " << ARRAY( rowI, colI) << endl; } } return 0; }
Last Modified: