You might have noticed that [tt]printf(message);[/tt] does not print a line break, although you
did enter a linebreak on input. That is because [tt]scanf("%s")[/tt] scans until the first
whitespace character. The linebreak is rejected by [tt]scanf()[/tt], and not added to [tt]message[/tt]. It is still in the input stream.
Your [tt]scanf("%c")[/tt], then, reads the linebreak, and doesn't wait for you to input y or n.
As always when your code confuses you, assert your assumptions. Obviously yes_no was filled with some strange value that was not "y" nor "Y". Changing:
Code: Select all
printf("again???, [Y]es or [N]o:");
scanf("%c", &yes_no);
}
to:
Code: Select all
printf("again???, [Y]es or [N]o:");
scanf("%c", &yes_no);
printf("%d\n", yes_no);
}
would have told you what value that is (10), and
that would probably have given you the clue.