Random variables changing for no reason

When the code accesses an element of the bet array, it takes the starting memory address of the array and adds ( sizeof(int) * array index ) to that address. With bet[7], that would be the first memory address after the array, since the array has only 7 elements ( 0 through 6). With your code, pNum happens to be stored at that location.

What makes errors like this difficult to locate is that something completely unrelated to the actual error, such as simply printing a variable to Serial, can cause the compiler to rearrange the variable storage locations and move the error to a different variable, or possibly eliminate it entirely if the affected memory location is unused.