返回值
如果c是十六进制数字,则此函数返回非零值(true),否则返回零(false)。
示例
以下示例显示isxdigit()函数的用法-
#include <stdio.h>
#include <ctype.h>
int main () {
char var1[] = "tuts";
char var2[] = "0xE";
if( isxdigit(var1[0]) ) {
printf("var1 = |%s| is hexadecimal character\n", var1 );
} else {
printf("var1 = |%s| is not hexadecimal character\n", var1 );
}
if( isxdigit(var2[0] )) {
printf("var2 = |%s| is hexadecimal character\n", var2 );
} else {
printf("var2 = |%s| is not hexadecimal character\n", var2 );
}
return(0);
}
尝试一下
让我们编译并运行上述程序,以产生以下结果-
var1 = |tuts| is not hexadecimal character
var2 = |0xE| is hexadecimal character