![]() |
atoi/atof problem
How will I capture a string or char input if I have a checker that is equated to zero
because atoi/atof reads the string or char as zero Code:
#include <stdio.h> |
Re: atoi/atof problem
atoi and atof function will return the converted values.
your checking the return value is 0 or not. instead of you can check the given string is digit or not using isdigit() or isalpha() |
Re: atoi/atof problem
How to do that?I don't know how to use the ctype.h
|
Re: atoi/atof problem
isdigit takes a char parameter and returns TRUE or FALSE depending on whether it's a digit or not. So the following will output 01:
Code:
printf("%c%c", isdigit('x')?'1':'0', isdigit('3')?'1':'0'); |
| All times are GMT +5.5. The time now is 09:10. |