After coding my Bricks for BREAKOUT, I get Segmentation error and my Paddle, Ball, and Scoreboard no longer appear! The bricks look great, but everything else disappeared and I get the fault error. Here is my code:
void initBricks(GWindow window)
{
int brick1 = 4;
int brick2 = 40;
string colors[5];
colors[0] = "RED"
colors[1] = "ORANGE"
colors[2] = "YELLOW"
colors[3] = "GREEN"
colors[4] = "BLUE"
for(int row = 0; row <= ROWS; row++)
{
for(int col = 0; col<= COLS; col++, brick1 += 40)
{
GRect brick = newGRect(brick1, brick2, WIDTH/13, 10);
setFilled(brick, true);
setColor(brick, colors[row]);
add(window, brick);
}
brick2 += 20;
brick1 = 4;
}
}
valgrind
? – Kareem♦ Jun 22 '15 at 18:14