title: Alternative to atof() function to differenciate input 0 with failure
body: <p>I created a function to validate the input of real numbers . It is working well , but as the <code>atof()</code> function returns <code>0</code> upon failure, it is not possible to enter <code>0</code> as an input value. Anyone can give help to solve this?</p>
  
  <pre><code>float validate_float()
  {
      float num;
      char str[8];
      do
      {
          printf("enter a float number:");
          fflush(stdin);
          gets(str);
          num=atof(str);
      }
      while(num==0);
      return num;
  }
  </code></pre>