ARRAYS

int array[0][0];

A 0 by 0 array. How useless is that?

You are writing WAY out of bounds of that array, and then reading out of bounds. Rubbish is not surprising.