What does IndexOutofRangeException mean?

前端 未结 3 1618
梦谈多话
梦谈多话 2020-12-22 12:24

It says that in my array that I have gone over the index. My program is a Number Guessing game played by 5 players (5 indexes). I have used arrays to create the object and p

3条回答
  •  借酒劲吻你
    2020-12-22 12:39

    It means that you are trying to access an index bigger than the array. In the line:

    while(playedThisRound[index] == false)
    

    You don't check the boundaries before using the index, and your crash is probably there.

提交回复
热议问题