#include <stdio.h>
#include <ctype.h>


int mygetd(double *result){
   char c, buff [ 32 ];
   return fgets(buff, sizeof buff, stdin) && !isspace(*buff) &&   sscanf(buff, "%lf%c", result, &c) == 2 && (c == '\n' || c == '\0');} 


int main(void){
   double value;
   do   {
      fputs("Enter a floating-point number: ", stdout);
      fflush(stdout);   } while ( !mygetd(&value) );
   printf("value = %g\n", value);
   return 0;
}

Credit to Dave Sinkula http://www.daniweb.com/code/snippet216600.html

Hi Guys,

May i know how do i add a range @ the mygetd function inside.

First off, rewrite the return so it is understandable (i.e. simple). Then explain what you want. Your request makes little sense.