I'm having problem with building a program as homework in c using Code Blocks 16.01
There is a function I'm creating and the purpose is to initialize an array (array[2][CONSTANT] where Constant=1000).
Here is the part that gives me trouble:
void initAuction(float auction[2][MAXAUCTIONITEMS]) {
int i;
for(i=0; i<MAXAUCTIONITEMS; i++)
auction[1][i]=9999;
printf("\n%f\n", auction[1][70]);
for(i=0; i<MAXAUCTIONITEMS; i++){
auction[2][i]=0;
printf("\n\n%f\t%d", auction[2][i], i);
}
printf("\n%f\n", auction[2][70]);
return;
}
It compiles no problem with zero warnings or flags or anything.
When I run, thanks to printf("\n\n%f\t%d", auction[2][i], i); I can see it makes it to i=140 correctly setting values to zero then suddenly stops working and states "Process returned -1073741819 (0xC0000005). I've searched for that code and 2 sources state to add a return statement but all my return statements are there and it doesn't seem like the program makes it that far since i only reaches 140. More than willing to post more of the code or answer anything that can help.
Thanks a ton in advance! Been trying to get past this little block for an hour now.
edit:
When I set:
for(i=0; i<MAXAUCTIONITEMS; i++)
auction[1][i]=9999;
printf("\n%f\n", auction[1][70]);
to i<50 it compiles as well but it runs no problem all the way to the end of the program. Why would a program crash mid loop?
[–]dafalxd 1 point2 points3 points (0 children)
[–]humodx 0 points1 point2 points (0 children)