I am trying to write a game where you need to try to guess the random number between 1 and 100. The basic code is a simple do-while loop and it works normally.
My problem is an array that contains the players guesses. It somehow ignores the players first two guesses and adds two zeroes in the end of the array. I have tried to figure this out for a while, but I don't seem to find the error. :(
look at line 19, then ask if you're really sure what the value of i is at the start of the program.
Also your indentation style seems very arbitrary which leads to confusion. At first glance, I thought line 34 started a while loop and you left the braces out of line 35 and 38.
Since you had not initialized i, the value stored in i was just whatever random junk happened to be in memory at the location i was assigned to point to by the compiler. Always initialize your data.