You do not normally want to compare the return value, just treat it as a Boolean:
if (isalpha(someinput))
do_whatever();
If you insist on doing a comparison, it needs to be !=0
, but it's entirely redundant and pointless.
You use it on characters that have been read from input, which are not (at that point) floats or anything, just groups of characters. In the case of a float, some of those will be digits, but many will also include decimal points (which aren't digits) and possibly an occasional e
, +
or -
as well.
Also note that you normally need to cast the input to unsigned char
before calling any of the is*
functions. Many character sets will treat some characters as negative when they're viewed as signed char
, and passing a negative value to any of these gives undefined behavior.