|| takes two arguments, in your case answer == 'y' and 'Y', and returns false if both arguments are false otherwise it returns true. If an integer is used in place of a boolean 0 will be treated as false and everything else as true. 'Y' is not 0 so it will treated as true, so that is why the whole or-expression returns true.