Back to notes -- Keyboard shortcut: 'u'  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Slide program -- Keyboard shortcut: 't'    The function askUser of main.Lecture 1 - slide 3 : 22
Program 4
answer askUser(char *question){
  char ch;
  do {
    printf("%s [y/n]? ", question);
    while (isspace(ch = fgetc(stdin)));
    if (ch == 'y') 
      return yes;
    else if (ch == 'n')
      return no;}
  while (ch != 'y' || ch != 'n');
}