iswpunct - C wctype.h

C examples for wctype.h:iswpunct

Type

function

From


<cwctype>
<wctype.h>

Description

Check if wide character is punctuation character

Prototype

int iswpunct (wint_t c);

Parameters

Parameter Description
c Wide character to be checked

Return Value

A non zero value (i.e., true) if c is a punctuation character. Zero (i.e., false) otherwise.

Demo Code


#include <stdio.h>
#include <wctype.h>
int main ()/*w w w  .  ja  v  a  2s . co  m*/
{
  int i=0;
  int cx=0;
  wchar_t str[] = L"this is a test! **&^*&^%$#%$#@!~";
  while (str[i])
  {
    if (iswpunct(str[i]))
        cx++;
    i++;
  }
  wprintf (L"The sentence contains %d punctuation characters.\n", cx);
  return 0;
}

Related Tutorials