Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <b>isalpha() test for alphabetic character (macro)</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
isalpha()                Test for Alphabetic Character (Macro)

 #include   <ctype.h>

 int        isalpha(c);
 int        c;                           Integer to be tested

    isalpha() is a macro that tests if 'c' is an alphabetic character;
    that is, if it is included in the set:

       A-Z  or  a-z.

    Returns:    True (nonzero) if the integer is in one of the sets, and
                0 if not. The result is undefined if 'c' is other than an
                ASCII character or EOF (i.e., undefined if c > 127). .

      Notes:    isalpha() is a macro.

  -------------------------------- Example ---------------------------------

    The following statements get input from stdin, testing that only
    alphabetic characters are stored.

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

         int x = 0;
         char buffer[80];
         int ch;

         main()
         {
            while (isalpha(ch = getchar()))
                  buffer[x++] = ch;
            printf("data input from console: %s \n",buffer);
         }

See Also: isalnum()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson