I want to store the byte value of aFloat in pixelsArray for each 3D coordinate, in a 1D array:
float aFloat = 1.0; unsigned char* pixelsArray = new unsigned
Your inside line needs to be:
pixelsArray[(i * WIDTH + j) * 3 + k] = (unsigned char)(255.0 * aFloat);
This should give you an all-white image.
Make sure your target is really three bytes per pixel and not four (alpha channel or padding); if it is four, you'll just need to change the 3 above to a 4.
3
4