I'm trying to make a macro in C that can tell if a char is a hex number ( 0-9 a-z A-Z)
#define _hex(x) (((x) >= "0" && (x) <= "9" )||( (x) >= "a" && (x) <= "z") || ((x) >= "A" && (x) <= "Z") ? "true" : "false")
This what I've come up with but it won't work with a loop like this
char a;
for(a = "a" ; a < "z";a++){
printf("%s => %s",a, _hex(a));
}
it gives an error
test.c:8: warning: assignment makes integer from pointer without a cast
test.c:8: warning: comparison between pointer and integer
test.c:9: warning: comparison between pointer and integer
test.c:9: warning: comparison between pointer and integer
test.c:9: warning: comparison between pointer and integer
test.c:9: warning: comparison between pointer and integer
test.c:9: warning: comparison between pointer and integer
test.c:9: warning: comparison between pointer and integer