some 1 told me char comparison if(c>='a' && c<='z')
not portable.
example
int main() { char c; scanf("%c", &c); if(c>='a' && c<='z') printf("lower case\n"); }
any proof char comparison if(c>='a' && c<='z')
not portable?
the c standard not guarantee lower case letters appear between 'a'
, 'z'
in execution character set.
in ebcdic encoding, there other characters between 'a'
, 'z'
, , c implementations use ebcdic.
the c standard guarantee digits consecutive, '0' <= d && d <= '9'
test whether d
decimal digit character.
Comments
Post a Comment