The following code snippets are from a C program.
The user enters Y or N.
char *answer = \'\\0\';
scanf (\" %c\", answer);
if (*answer == (\'Y\' ||
answer
shouldn't be a pointer, the intent is obviously to hold a character. scanf
takes the address of this character, so it should be called as
char answer;
scanf(" %c", &answer);
Next, your "or" statement is formed incorrectly.
if (answer == 'Y' || answer == 'y')
What you wrote originally asks to compare answer
with the result of 'Y' || 'y'
, which I'm guessing isn't quite what you wanted to do.