Lenguaje C: función isprint (prueba de caracteres impresos)

Los datos expuestos en este blog, son solo de índole informativo. Por favor realiza siempre una copia de seguridad antes de realizar cualquier cambio en tu proyecto.

Lenguaje C: función isprint
(prueba de caracteres impresos)

En el lenguaje de programación C, función de impresión Pruebe si c es un carácter de impresión y si contiene espacios. Si no desea incluir espacios, pruebe la función isgraph.

sintaxis

La sintaxis de la función isprint en lenguaje C es:

int isprint(int c);

parámetro o parámetro

c Un valor para probar si es un carácter de impresión y contiene espacios.

devolver los bienes

La función isprint devuelve un valor distinto de cero si c es un carácter de impresión, o cero si c no es un carácter de impresión.

titulo requerido

En C, los archivos de encabezado requeridos por la función isprint son:

#include <ctype.h>

aplicar para

En C, la función isprint está disponible en las siguientes versiones:

  • ANSI/ISO 9899-1990

ejemplo de esprint

/* Example using isprint by TechOnTheNet.com */

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

int main(int argc, const char * argv[])
{
    /* Define a temporary variable */
    unsigned char test;

    /* Assign a test printable letter to the variable */
    test="T";

    /* Test to see if this character is a printing character */
    if (isprint(test) != 0) printf("%c is a printing charactern", test);
    else printf("%c is not a printing charactern", test);

    /* Assign a non-printing character to the variable */
    test = 0; /* This is NUL */

    /* Test to see if this character is a printing character */
    if (isprint(test) != 0) printf("NUL is a printing charactern");
    else printf("NUL is not a printing charactern");

    return 0;
}

Cuando se compila y ejecuta, esta aplicación generará:

T is a printing character
NUL is not a printing character

Función similar

Otras funciones de C similares a la función isprint:

  • función de control
  • función isgrafa
  • función espacial