Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. I check, compile and run every program. Contact me at: aviboots(AT)netvision.net.il

Hostgator - Save 50% Off Your New Optimized WordPress Hosting With Coupon: WDA50

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Dedicated Hosting Superb Internet

simplilearn big data and analytics

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Buy Cool Shirts

getflywheel wordpress hosting


Distribute your Resume to 500+ Job Boards & Recruiters


6,300 questions

8,938 answers

573 users

How to use all <ctype.h> functions for classifying and converting characters in C

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial


10 views
asked Aug 29 by avibootz
edited Aug 29 by avibootz

1 Answer

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

int main(void)
{
    int ch = 'Z';
    
    // Checks if ch is alphabetic (A-Z, a-z)
    printf("isalpha(ch) = %d\n", isalpha(ch));
    
    // Checks if ch  is alphanumeric (A-Z, a-z, 0-9)
    printf("isalnum(ch) = %d\n", isalnum(ch));

    // Checks if ch is a digit (0-9)
    printf("isdigit(ch) = %d\n", isdigit(ch));
    
    // Checks if ch is a lower-case letter (a-z)
    printf("islower(ch) = %d\n", islower(ch));
    
    // Checks if ch is a upper-case letter (A-Z)
    printf("isupper(ch) = %d\n", isupper(ch));
    
    // Checks if ch is a white-space character
    printf("isspace(ch) = %d\n", isspace(ch));
    
    // Checks is ch is a control character (0x00-0x1F, 0x7F)
    printf("iscntrl(ch) = %d\n", iscntrl(ch));
    
    // Checks if c is any printable character including space
    printf("isprint(ch) = %d\n", isprint(ch));
    
    // Checks if c is a punctuation character
    printf("ispunct(ch) = %d\n", ispunct(ch));
    
    // Checks if ch is printing character except space
    printf("isgraph(ch) = %d\n", isgraph(ch));

    // Checks if ch is a blank character (space or tab)
    printf("isblank(ch) = %d\n", isblank(ch));
    
    // Checks if ch is a hexadecimal digit (A-F, a-f, 0-9)
    printf("isxdigit(ch) = %d\n", isxdigit(ch));
    
    
    printf("tolower(ch) = %c\n", tolower(ch));
    printf("toupper(ch) = %c\n", toupper(ch));
    
       
    return 0;
}

   
/*
run:
 
isalpha(ch) = 1
isalnum(ch) = 1
isdigit(ch) = 0
islower(ch) = 0
isupper(ch) = 1
isspace(ch) = 0
iscntrl(ch) = 0
isprint(ch) = 1
ispunct(ch) = 0
isgraph(ch) = 1
isblank(ch) = 0
isxdigit(ch) = 0
tolower(ch) = z
toupper(ch) = Z

*/

 




answered Aug 29 by avibootz
...