title: How to repeat a menu (ask for user input again) after switch got a wrong input character
body: <p>I have a menu, one of the options is to exit the program, but if the user types a character other than 1 2 3 4 5 6 it still exits the program or stops running it. I want that after input of a wrong character the menu apears again and the user can type again. I want this to hapen infinitly if the user types wrong characters infinitly.
  Thanks a lot!</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  
  int main(void)
  {
    char opcao;
  
  
    printf("1 - \n"); 
    printf("2 -\n"); 
    printf("3 - \n"); 
    printf("4 - \n"); 
    printf("5 - \n"); 
    printf("6 - Terminar programa\n");  
    printf("Introduza a sua opcao:\n");
    scanf("%c",&amp;opcao);
  
        switch(opcao){
      case'1':
        printf("Funcionalidade nao disponivel.");
        break;
      case'2':
        printf("Funcionalidade nao disponivel.");
        break;
      case'3':
        printf("Funcionalidade nao disponivel.");
        break;
      case'4':
        printf("Funcionalidade nao disponivel.");
        break;
      case'5':
        printf("Funcionalidade nao disponivel.");
        break;
      case'6':
        exit(0);
      default:
        printf("invalid input, please type again"); // this is what I want, but how?(now it would present the menu again...
        break;
        }
  
    return 0; 
  }
  </code></pre>