C
C#5mo ago
fraantic

How can I check if an index of a 2d array is out of bounds?

tittle
if (array[value1][value2] == outOfBounds) {
// do smth
}
if (array[value1][value2] == outOfBounds) {
// do smth
}
2 Replies
Keswiik
Keswiik5mo ago
check the length of each array compared to the indexes you are attempting to access
fraantic
fraanticOP5mo ago
ok

Did you find this page helpful?