It seems that this declaration:
int scores[5];
Is incorrect. This creates an array with 5 numbers in it, indices from scores[0-4]
, however, you constantly refer to score[5]
, the sixth element of the array throughout your program. I recommend changing to
int scores[6];
2
solved Error when accessing array – stack around the variable ‘scores’ was corrupted [closed]