Simplest way to use isdigit and isalpha commands ?

Posted by ZaZu on Stack Overflow See other posts from Stack Overflow or by ZaZu
Published on 2010-05-11T20:29:03Z Indexed on 2010/05/11 20:34 UTC
Read the original article Hit count: 275

Filed under:
|
|
|

Hello,

Can anyone briefly explain how do these two commands work ?

isdigit and isalpha .. Ofcourse I read online sources before asking the question, but unfortunately I tried them and didnt get them to work.

What is the simplest way ?

I know it gives back a value, so im assuming I can use it like this :

if(isdigit(someinput)==1)
 return -1;

Is that correct ? can I use this for any number ? Can I compare it with a float number ? Can I compare arrays ?

Can I also use it when scanning documents or files ?

For example, if I want to scanf a text file that has numbers and letters, and determine is what im scanning (isdigit) or (isalpha) ??

Thanks :)

© Stack Overflow or respective owner

Related posts about c

    Related posts about stdio