1) Regarding the original question, next time
say what the problem is. If you have a compiler error, post the error(s). If you have a linker error, similarly. If it just plain doesn't do what you expected, describe (i) what you expected and (ii) what actually happened.
2) Of course you need breaks in the switch statement for that approach to work. But there is no reason to use a switch statement in the first place. See how you're already doing some arithmetic based on drawX to find the X drawing position? That's smart. Do the same thing for the Y coordinate.
3) The array of flags and the array of block image pointers are redundant. You can either:
a) Just keep the array of flags, and hard-code the drawing loop to use the one surface pointer; or
b) Just keep the array of pointers, and when a block is destroyed, set the corresponding pointer to NULL; and in the drawing loop, skip drawing when you find a NULL pointer.
4) If you decide to keep the flags, use either booleans or an enumeration, instead of integers. In C++, we have a real boolean type, named "bool", so you don't have to think about things like "0 means false and everything else means true". You can actually use the names 'true' and 'false', and you can use the state of a boolean variable directly to control a loop/if statement instead of comparing it to anything.
I show code below with the "null pointer for skipped block" approach. This is flexible; it easily lets you use multiple block images, by just setting the pointers. (With an enumeration, you would have to use the enumeration value to look up the corresponding block. And with a boolean, you couldn't do it at all.)
void blocks::drawblocks(){ const int HORIZONTAL_SPACING = ((SCREEN_WIDTH / 8) - (BLOCK_WIDTH / 2)); const int VERTICAL_SPACING = 40; for(int drawY = 0; drawY < 5; drawY++) { for(int drawX = 0; drawX < 8; drawX++) { SDL_Surface* block = blocksArray[drawY][drawX]; // You can use pointers directly for if statements, too; // the condition is true when the pointer is not NULL. if (block) { apply_surface( HORIZONTAL_SPACING * (drawX + 1), VERTICAL_SPACING * (drawY + 1), block, screen, NULL ); } } }}
Also keep in mind for when you're removing blocks, that you need to clear the screen before you start this drawing process. Otherwise, the old images of removed blocks will remain on the 'screen' surface.