title: when scanf returns 0 in c and just doesn't work
body: <p>'when there is no successful assignments' i know that scanf returns 0 to indicate it, but is that the only thing that it does? this is my code: </p>
  
  <pre><code> #include&lt;stdio.h&gt;
    int main(void) {
        int val,x;
        x=scanf("%d",&amp;val);
       if(x==1)
         printf("success!");
       else{
         printf("try again\n");
         scanf("%d",&amp;val);
        }
     return 0;
   }
  </code></pre>
  
  <p>if i enter a number, it works fine but if i enter a character scanf doesn't work anymore, this is what i get:</p>
  
  <pre><code>   k
     try again
     process returned 0 (0x0)  execution time :2.578 s
     press any key to continue.
     _
  </code></pre>
  
  <p>meaning that it doesn't allow me to enter a new value, why is that? is there something wrong in the code? if yes how can i fix it? should i stop using scanf?</p>