Friday, 28 April 2017

Character Class Testing

      // 1. The following program displays not digit
        #include <stdio.h>
        #include <ctype.h>
        int main()
        {
            int i = 9;
            if (isdigit(i))
                printf("digit\n");
            else
                printf("not digit\n");
                return 0;
        }


// 2. The following c program displays not space
        #include <stdio.h>
        #include <ctype.h>
        int main()
        {
            int i = 0;
            if (isspace(i))
                printf("space\n");
            else
                printf("not space\n");
                return 0;
        }

// 3. The following c program displays s
   #include <stdio.h>
        #include <ctype.h>
        int main()
        {
                     printf("is :%c\n", tolower('S'));
        }



No comments:

Post a Comment