your loop is goin infinite because of your array index overflowed. when the loop = 0, InpArray[loop] = InpArray[0] = 1,then the if-clause...
Separate names with a comma.