I have a struct containing 3 bytes, one for each pixel, a 2D array of these is to be written into a bitmap file generated the program. The size of this array is not known at compile time.
At present I am declaring a double pointer using ** symbol and then use the 'new' keyword to create the dynamic 2d array. However, this is how it would be done in C.
It might be useful to think of the pixel data as a contiguous block of memory (in effect a one-dimensional array) as this could make it possible to write the data to the file (or read it from a file) in a single write (or read) operation.
Bear in mind that each row of pixel data needs to be padded to a multiple of 4 bytes.
A C++ class could be used to contain the pixel data, and facilitate access by row and column number.