The function prototype is not necessary to draw the brick wall. The whole thing can be included in the main function void DarkGDK(). It was added on purpose to practice with a function prototype.

********************************************************

#include “DarkGDK.h”
// Function prototype
void drawBrick();
/*
Constant global variables. Added as a global is not necessary. It could have been added locally in the drawBrick() function. This is for practice with global variables. Setting constant variables could have been set as simply int variables locally in the drawBrick() function, but was done for practice using const in variables. Note that the textbook uses DWORD to declare the color variable as a 32 bit unsigned integer. You can use int or DWORD. Both work. I keep is simple and use int.
*/
const int red = dbRGB(255,0,0);
const int black = dbRGB(0,0,0);
const int blue = dbRGB(0,0,255);
//******************************************************
// DarkGDK function *
//******************************************************
void DarkGDK ()
{
// Seed the random number generator dbRND located in the drawBrick() function. dbRandomize( dbTimer() );
// Call the drawBrick function
drawBrick();
// After drawBrick() is finished, pause the program until the user presses a key.
dbWaitKey();
}
/********************************************************************
The drawBrick function draws red and blue bricks.
The function draws bricks 40 pixels wide and 20 pixels high, *
allowing for one pixel border around the bricks
**********************************************************************/
void drawBrick()
{
for(int x=0; x<=800; x+=40) /* as long as x = to 0 and less than or equal 800, draw some bricks 40 pixels wide below in dbBox*/
{
for(int y=0; y<=600; y+=20) /* as long as y = to 0 and less than or equal 600, draw some bricks 20 pixels high below in dbBox*/
{
// Draw blue bricks randomly; number for a is less than random number for b on the pixel grid*/
int a = dbRND(20);
int b = dbRND(50);
if(a<b)
{
dbInk(blue,black);
dbBox(x+1,y+1,x+39,y+19);
}
else // otherwise draw the red bricks at the dimensions above
{
//draw red bricks
dbInk(red,black);
dbBox(x+1,y+1,x+39,y+19);
}
}
}
}