Embedded Artistry libc
C Standard Library Support for Bare-metal Systems
isprint.c File Reference
#include <ctype.h>
Include dependency graph for isprint.c:

Go to the source code of this file.

Functions

int isprint (int c)
 Checks if the given character can be printed. More...
 

Function Documentation

◆ isprint()

int isprint ( int  ch)

Checks if the given character can be printed.

Checks if the given character can be printed using the default locale. The following characters are printable:

  • number (0123456789)
  • uppercase letter (ABCDEFGHIJKLMNOPQRSTUVWXYZ)
  • letter (abcdefghijklmnopqrstuvwxyz)
  • punctuation character (!"#$%&'()*+,-./:;<=>?@[]^_`{|}~)
  • space (0x20)

The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF.

Parameters
chThe character to classify
Returns
Non-zero value if the character can be printed, zero otherwise.

Definition at line 5 of file isprint.c.

6 {
7  return (unsigned)c - 0x20 < 0x5f;
8 }