Name

ispunct - character classification routines

Library

libc.lib

Synopsis

  #include <ctype.h>
  int ispunct (int c);

Return values

The ispunct function returns non-zero if ’c’ is a punctuation character and zero otherwise.

Detailed description

The ispunct function tests if ’c’ is a punctuation character i.e. it belongs to class punct(see defns for definition). Characters under class space or a character for which isalnum is true(non-zero) are excluded. In other words, it tests for punctuation characters. For single character representations, the value of the argument is representable as an unsigned char or the value of EOF.

The functionality of this API is independent of the program’s current locale and so it returns non-zero for all the characters (of various locales supported) that belong to the class punct, irrespective of the locale they belong to.


Examples

#include<ctype.h> //ispunct()
#include<stdio.h> //printf()
int test_ispunct()
{
  int arr[]={0x3003,’3’,0x301C,’*’, ’+’};
  int i = 0;
  int size = 5;
  for( i=0; i<size; i++)
  {
     int ret = ispunct(arr[i]); //call to the API with chars in arr[]
     if( (!ret) != 0 )
     {
         printf("\n0x%x is not a punc char ", arr[i]);
     }
     else
     {
         printf("\n0x%x is a punc char", arr[i]);
     }
}
printf("\n");
return 0;
}


Output

0x3003 is a punc char
0x33 is not a punc char
0x301c is a punc char
0x2a is a punc char
0x2b is a punc char


See also

iswpunct

Feedback

For additional information or queries on this page send feedback

© 2008 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user.

Top