I need to read a bmp file and display it as a 2d array of 1 and 0
if the pixel is blue the value in the array is 1 and 0 for white.
unsigned int temp;
int i, j, width, hight;
int** bmp;
FILE* pic;
fopen_s(&pic, "fishpool2.bmp", "rb");
pic_size(pic, &width, &hight);
printf_s("width = %d\thight = %d\n", width, hight);
fseek(pic, 54, SEEK_SET);
for (i = 0; i < hight; i++) {
for (j = 0; j < width; j++) {
temp = fgetc(pic);
fgetc(pic);
fgetc(pic);
if (temp >= 155 && temp <= 245) bmp[i][j] = 1;
}
}
for (i = 0; i < hight; i++) {
for (j = 0; j < width; j++) {
printf_s("%d", bmp[i][j]);
}
puts("");
}
this is what I have so far. I didn't include the code part with i allocate memory and getting the height and width of the pic. I don't know why but when I run the code the blue spots aren't in the correct position.
(I need to read the picture from the bottom left to top right)

