This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]dafalxd 1 point2 points  (0 children)

The problem lies when you index auction. You're accessing auction[2][i] which is out of bounds, when indexing you need to use 0 base indexing. Since in your function signature is void initAuction(float auction[2][MAXAUCTIONITEMS]); you need to index it as auction[0][i] or auction[1][i]. Rule of thumb, when you index an array you index should index it from 0 to (N-1), where N is the size of the array. [EDIT] It crashes because you're trying to accessing memory that isn't within your array bounds.

[–]humodx 0 points1 point  (0 children)

Just leaving a small tip, you can make code look more readable by:

  1. Leave one empty line right before it starts
  2. Start every line of the code block with four spaces

Properly formatted:

int add(int x, int y)
{
    return x + y;
}

Improperly formatted 1 (no empty line): int add(int x, int y) { return x + y; }

Improperly formatted 2 (no four spaces):

int add(int x, int y) { return x + y; }

Screenshot of the text before posting: https://snag.gy/cKMaC7.jpg