淡泊明志 宁静致远
分类: C/C++
2006-12-10 15:07:51
【C语言库函数源代码】
【本程序在Dev C++ 4.9.9.2 下编译通过】
int my_isascii( int ch )
{
return (unsigned int)ch <
128u;
}//判断字符c是否为ascii码。ascii码指0x00-0x7F之间的字符。
int main()
{
int ch = 'a';
if(my_isascii(ch))
printf("%c is ASCII
Character!\n",ch);
else
printf("%c is not a ASCII
Character!\n",ch);
ch = 0x80;
if(my_isascii(ch))
printf("0x%x is ASCII
Character!\n",ch);
else
printf("0x%x is not a ASCII
Character!\n",ch);
system("pause");
return 0;
}