title: C program skips fgets
body: <p>My program compiles ok but it when it calls the getinput() function it never prompts for input.</p>
  
  <p>Edited to show more code, I added fflush but it still skips it for some reason.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  
  
  main(){
  
      char mystring[] = "It's equal to it. ";
      int k = 32;
      int e;
      printf("Enter a number: ");
      scanf("%d",&amp;e);
      if(e == k){
          printf("\n\n%s\n",mystring);
  
      } else if(e &lt; k){
          printf("\n\n%d\n",e);
  
      } else {
  
  
          getinput();
      }
  
      exit(0);
  
  }
  
  int getinput(){
  
      char gettext[64];
  
      printf("Enter text here: ");
      fflush(stdout);
      fgets(gettext, 64, stdin);
      printf("\n\nYou entered: %s\n\n",gettext);
      return 0;
  
  
  }
  </code></pre>