#include <stdio.h>
#include <ctype.h>

/*
判断是控制字符(ASCII 0-31和127)的库函数:
满足指定的条件,返回非0;否则返回0.
iscntrl(c)
*/

/***************
 * 输入:要判断的字符。
 * 输出:是空白,返回1;其他,返回0.
 **************/
int my_iscntrl(unsigned char c)
{
	if ((c >= 0 && c <= 31) || c == 127) {
		return 1;
	}
	return 0;
}

int main(void)
{

	printf("%d\n", my_iscntrl('\n'));
	printf("%d\n", iscntrl('6'));

	return 0;
}

 

输出:

1

0

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2021-07-29
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
相关资源
相似解决方案