Hello guys,

I am new for programming in C language, my assignment is to read an image by using C Visual studio, and then apply on the photo a chessboard, So the result will be black squares sweeping with white squares, but inside the white squares you can see some parts of the photo like in the chessboard exactly.

I have wrote the following code:

for (yy = 0; yy < resY; yy += BLOCK){

for (xx = 0; xx < resX; xx += BLOCK){

for (y = yy; y < yy + BLOCK; y += 1){
for (x = xx; x < xx + BLOCK; x += 1){
if (copy_flag == 1){
Coutput.image[y][x] = Cinput.image[y][x];}
else{

copy_flag = !copy_flag;
Coutput.image[y][x] = 0;
}
copy_flag = !copy_flag;

}
}
}


but it doesnt work, could you help me please?

Thank you