1 #include <ctype.h> 2 3 isprint(int c)4int isprint(int c) 5 { 6 if (c >= 0x20 && c <= 0x7e) 7 { 8 return 1; 9 } 10 11 return 0; 12 } 13 islower(int c)14int islower(int c) 15 { 16 if (c >= 'a' && c <= 'z') 17 { 18 return 1; 19 } 20 21 return 0; 22 } 23 isupper(int c)24int isupper(int c) 25 { 26 if (c >= 'A' && c <= 'Z') 27 { 28 return 1; 29 } 30 31 return 0; 32 } 33 isalpha(int c)34int isalpha(int c) 35 { 36 if (islower(c) || isupper(c)) 37 { 38 return 1; 39 } 40 41 return 0; 42 } 43 isdigit(int c)44int isdigit(int c) 45 { 46 if (c >= '0' && c <= '9') 47 { 48 return 1; 49 } 50 51 return 0; 52 } 53 toupper(int c)54int toupper(int c) 55 { 56 if (c >= 'a' && c <= 'z') 57 { 58 return c - 'a' + 'A'; 59 } 60 return c; 61 } 62 tolower(int c)63int tolower(int c) 64 { 65 if (c >= 'A' && c <= 'Z') 66 { 67 return c - 'A' + 'a'; 68 } 69 return c; 70 } 71 isspace(int c)72int isspace(int c) 73 { 74 return (c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v' || c == ' '); 75 }