Help with functions/displaying multiple objects.

When I try to run this program (what I have so far) it says that the program has stopped working and forces me to close. I'm trying to display 10 bmp objects. When I debug I get the message: "Unhandled exception at 0x10004805 in lab9out.exe: 0xC0000005: Access violation reading location 0x00000044." when I get to the displayBMP commands. Can someone help me fix this?



#include <iostream>
#include "graph1.h"
#include <ctime>

void displayTargets(int target_x[], int target_y[], int targets[], int& no_targets);
bool fireCannonBall(int cannon_x, int cannon_y, int targets[], int target_x[], int target_y[], int no_targets);
void displayResults(int score, int elapsed_time, int shots);

int main()
{

srand(time(0));
int target_x[10];
int target_y[10];
int targets[10];
int no_targets = 10;

displayGraphics;

displayTargets(target_x,target_y,targets,no_targets);

//fireCannonBall();

//displayResults();

return 0;
}

void displayTargets(int target_x[], int target_y[], int targets[], int& no_targets)
{
int i;
int r = 1 + rand() % 460;
int r1 = 1 + rand() % 200;

for(i=0;i<=9;i++)
{
target_x[r];
}

for(i=0;i<=9;i++)
{
target_y[r1];
}

for(i=0;i<=9;i++)
{
int obj_no = targets[i];
}

displayBMP("cannon.bmp",0,439);

for(i-0;i<=9;i++)
{
displayBMP("target.bmp",target_x[0],target_y[0]);
}



}
//bool fireCannonBall(int cannon_x, int cannon_y, int targets[], int target_x[], int target_y[], int no_targets)
//{
//}
//void displayResults(int score, int elapsed_time, int shots)
//{
//}
Topic archived. No new replies allowed.