scanf is not skipped. It waits for me to enter input, but I have to enter the value and hit enter twice (the second input is properly saved).
int yes(void)
{
int yes, rc, isValid;
char answer, nl = 'a';
do {
clearKeyboard();
rc = scanf(" %c%c", &answer, &nl);
if (nl == '\n') { //|| rc != 2
if ((answer == 'y') || answer == 'Y') {
yes = 1;
isValid = 1;
}
else if ((answer == 'n') || answer == 'N') {
yes = 0;
isValid = 1;
}
else {
printf("*** INVALID ENTRY *** <Only (Y)es or (N)o are acceptable>: ");
isValid = 0;
clearKeyboard();
}
}
else {
printf("*** INVALID ENTRY *** <Only (Y)es or (N)o are acceptable>: ");
isValid = 0;
clearKeyboard();
}
} while (!isValid);
return yes;
}