How to make sure input is a double in the C programming language

Posted by Chris_45 on Stack Overflow See other posts from Stack Overflow or by Chris_45
Published on 2009-11-05T16:40:14Z Indexed on 2010/05/14 12:24 UTC
Read the original article Hit count: 163

Filed under:
|

How do I make sure I've got a double and not something else?

int main() {
    int flagOk = 0;
    double number;
    while(!flagOk) {
    	printf("Put in a double");
    	scanf("%lf", &number);
    	if(number == "%lf"); //this want make sure
    	flagOk = 1;
    }
}

© Stack Overflow or respective owner

Related posts about c

    Related posts about input-validation