Sign in to follow this  
Nanook

check for number input

Recommended Posts

That depends on your programming language and what method you are using to get your input.

Share this post


Link to post
Share on other sites
The return value of scanf() indicates how many of the input items were assigned. For example, if you had:

int i;
int r = scanf("%d", &i);

and entered "10" as the input, r would be 1. If you entered "fred" as the input, r would be 0.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this