I'm designing a graphics library which only works with a bitmap that is stored in memory.
Since a bitmap is 2-dimensional (x and y or columns and rows), i can use a 2-dimensional array.
//PIXEL_BIT is a user defined type to store RGB values of a single pixel
PIXEL_BIT buffer[1366][768];
From my understanding, C++ doesn't play nice with two dimensional arrays. Especially when it comes to dynamic 2-d arrays. So I believe, 2-dimensional arrays are not so cool to use as a buffer (or an in memory bitmap).
Another method to declare a buffer would be:
PIXEL_BIT *buffer = new PIXEL_BIT[1366 * 768];
I think this method is more efficient. So my question is, If you were to store a bitmap in memory what kind of a buffer would you use ? What's the best way to store a bitmap in memory (I think a block of memory that can be randomly accessed) ?
[Edit] I do understand what the heap and the stack are. And you should probably see this question: How do I declare a 2d array in C++ using new?