淡泊明志 宁静致远
分类: C/C++
2006-12-10 14:07:22
【C语言库函数源代码】
【本程序在Dev C++ 4.9.9.2 下编译通过】
int my_isalnum ( int ch )
{
return (unsigned int)((ch |
0x20) - 'a') < 26u ||
(unsigned int)( ch -
'0') < 10u;
}//测试参数ch是否是字母(A-Z,大小写均可)或数字(0-9)
int main()
{
char ch =
'c';
if(my_isalnum(ch))
printf("%c is English Character or
Number!\n",ch);
else
printf("%c is not a English Character
and Number!\n",ch);
ch = '1';
if(my_isalnum(ch))
printf("%c is English Character or
Number!\n",ch);
else
printf("%c is not a English Character
and Number!\n",ch);
ch = '!';
if(my_isalnum(ch))
printf("%c is English Character or
Number!\n",ch);
else
printf("%c is not a English Character
and Number!\n",ch);
system("pause");
return 0;
}