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>ispunct() test for punctuation character</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ispunct()                Test for Punctuation Character

 #include   <ctype.h>

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

    ispunct() tests if 'c' is a punctuation character. A punctuation
    character is one that is not alphabetic, not numeric, not a control
    character, and not a white space.

    Returns:    True (nonzero) if the integer satisfies the test
                condition or false (zero) if it does not.  The result is
                undefined if 'c' is other than 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>

         char *buffer;
         int c;
         int x;


          main()
          {
              buffer = "If you go down to the woods today...";
              for (x = 0; x < strlen(buffer); x++)
                if (ispunct(buffer[x])) {
                   fputchar(buffer[x]);
                   fputchar('\n');
                }
                else if (isprint(buffer[x]))
                   fputchar(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