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

 #include   <ctype.h>

 int        ispunct(c);
 int        c;                           Integer value to be tested

    ispunct() tests whether 'c' is a punctuation character--in other
    words, a character that is not alphabetic, numeric, a control
    character, or a white space.

       Returns:     Nonzero if the test is true, and zero if it is false.
                    The result is undefined if 'c' is not an ASCII
                    character or EOF.

         Notes:     ispunct() is a macro.

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

    The following statements print out the contents of a string, putting
    in a new-line character after each punctuation character.

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

           char *buffer;
           int c;
           int x;


           main()
           {
               buffer = "If you go down to the woods today,
                          you better go in disguise!";
               for (x = 0; x < strlen(buffer); x++)
                 if (ispunct(buffer[x])) {
                    putchar(buffer[x]);
                    putchar('\n');
                 }
                 else if (isprint(buffer[x]))
                    putchar(buffer[x]);
           }



See Also: isalnum() isascii() iscntrl() isdigit() isgraph()

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