to check for mixed input

May 7, 2013 at 8:09am
suppose i take an int type variable and give input in that which is mix of int as well as char type. so which function should be used to determine that the given input is not of the desired data type.
May 7, 2013 at 12:01pm
May 8, 2013 at 4:15am
please help me more
i am just a beginner in c.
May 9, 2013 at 4:14am
sffdsfd
May 9, 2013 at 9:06am
I don't know what you are asking.

Just guessing your problem, before assigning, check the ascii value and decide accordingly on what needs to be done.

1
2
3
char c;   //lets say, some value already assigned to c
if(c > '0' || c < '9')
printf("%c is not a integer character", c);


Last edited on May 9, 2013 at 9:06am
Topic archived. No new replies allowed.