Binary search use in simple guessing game
I'm thoroughly puzzled by your use of the response variable.

The condition for the while-loop is response != 'Y'.  The first time through, response is an uninitialized variable, containing any imaginable int value.  So, the behaviour of your program is undefined.

response is an int.  Why are you comparing it to 'Y'?  That makes 89 a special number.

If we make it inside the loop, you ask the user to enter a character 'L', 'H', or 'Y', but actually read an integer.  If you actually enter one of those three characters, scanf() will fail to read an integer; your program will consider the input to be invalid, and it will loop forever, since scanf() will immediately fail again, etc.  There are only two ways to terminate your program: CtrlC or by typing 89Enter at the prompt.

Then you call toupper() on the integer; the toupper() function only makes sense for translating a letter to its uppercase counterpart.  (The toupper() function takes an int instead of a char only because it is meant to support EOF, or -1, as a value.)

Then, in the switch block, you have magic numbers 72, 76, and 89.  Magic numbers should not exist in your code.



Your first printf() call is also wrong.  It should be

printf("Okay, let's start. Is it %d?\n", guess);


since &amp;guess would print the address of the guess variable instead of its contents.  Your compiler should have warned you about that mistake.  You should have heeded the warning, as well as tested your code.