Section courante

A propos

Section administrative du site

ISPRINT

Est-ce imprimable ?
Turbo C ctype.h

Syntaxe

int isprint(int caractere)

Paramètres

Nom Description
caractere Ce paramètre permet d'indiquer le caractère à vérifier

Description

Cette fonction indique si le caractère est imprimable.

Exemple

Voici un exemple permettant d'afficher les caractères imprimable (1) ou non (0) entre l'intervalle 32 et 127 :

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4.  
  5. int main() {
  6.  int I;
  7.  for(I = 32; I <= 127; I++) {
  8.   printf("%c = %i, ",I,isprint(I)?1:0);
  9.  }
  10.  printf("\n");
  11.  return 0;
  12. }

on obtiendra le résultat suivant :

= 1, ! = 1, " = 1, # = 1, $ = 1, % = 1, & = 1, ' = 1, ( = 1, ) = 1, * = 1, + =
1, , = 1, - = 1, . = 1, / = 1, 0 = 1, 1 = 1, 2 = 1, 3 = 1, 4 = 1, 5 = 1, 6 = 1,
7 = 1, 8 = 1, 9 = 1, : = 1, ; = 1, < = 1, = = 1, > = 1, ? = 1, @ = 1, A = 1, B
= 1, C = 1, D = 1, E = 1, F = 1, G = 1, H = 1, I = 1, J = 1, K = 1, L = 1, M = 1
, N = 1, O = 1, P = 1, Q = 1, R = 1, S = 1, T = 1, U = 1, V = 1, W = 1, X = 1, Y
= 1, Z = 1, [ = 1, \ = 1, ] = 1, ^ = 1, _ = 1, ` = 1, a = 1, b = 1, c = 1, d =
1, e = 1, f = 1, g = 1, h = 1, i = 1, j = 1, k = 1, l = 1, m = 1, n = 1, o = 1,
p = 1, q = 1, r = 1, s = 1, t = 1, u = 1, v = 1, w = 1, x = 1, y = 1, z = 1, { =
1, | = 1, } = 1, ~ = 1,  = 0,


Dernière mise à jour : Samedi, le 4 juillet 2015