Oct 14, 2011

C program to find the character type.

C Program to find the Character types. Here we used the isdidit(), isalpa(), and isspace() functions. isdigit() function returns true if argument is a decimal digit, otherwise false. isalpa() function returns true if argument is a defined set of characters in c, otherwise false. isspace() function returns true if argument is a white space character (one of ' ' '\f' '\n' '\r' '\t' '\v'), otherwise false. Read more about C Programming Language .



/***********************************************************
* You can use all the programs on  www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact info@c-program-example.com
* To find more C programs, do visit www.c-program-example.com
* and browse!
* 
*                      Happy Coding
***********************************************************/



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

#define FALSE 0
#define TRUE  1

    /* function declarations   */
int char_type(char);

main()
   {
   char ch;
   /* get a character from the keyboard  */
   printf(" Please enter a charcater => ");
   ch = getc(stdin);

   char_type(ch); /* Figure out the character type  */
   }


int char_type(char ch)
   {
   /* returns non zero if A-Z or a-z  */
   if ( isalpha(ch) != FALSE)
      printf("%c is an Alpha character.\n",ch);

   /* returns non zero if 0-9    */
   if ( isdigit(ch) != FALSE)
      printf("%c is a numeric character.\n",ch);

   /* returns non zero if a space, CR, Tab, NL FF  */
   if ( isspace(ch) != FALSE)
      printf("%c is white space\n", ch);

   }
Read more Similar C Programs
Searching in C

C Strings

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it


(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!