i have a function that searches through a struct array for a piece with co-ordinate x and co-ordinate y. If it finds it it returns the index of the array element if it cant find it it returns -1. i then use that index to address the array to update an element within the struct.
if the index is -1 i WAS then trying to update one of the struct array elements with an index of -1 ie
i never got an error or program crash in fact i only discovered this when debugging another function last night.Code:index = -1 white[index].taken = true;
Why did it allow me to do this?
coop