Flattening Multidimensional Arrays
Edit: Thank you, fixitman for the insightful comment; the code has been fixed to work with non-square arrays as well.
In an effort to produce a better performing multidimensional array, I would like to share the following with you. Say we have a Matrix (or multidimensional array) of 5 x 5 integer elements, M. In order to allocate such an array in C++, we use the following code: