Tutorials Point


  Learning C
  C Function References
  C Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     About TP     Advertising  

C - ispunct function

previous

Synopsis:

#include <stdio.h>

int ispunct(int c); 

Description:

The function returns nonzero if c is any of:

! " # % &  ' ( ) ; < = >> ? 
[ \ ] * + , - . / : ^ _ { | } ~

Return Value

The function returns nonzero if c is punctuation otherwise this will return zero which will be equivalent to false.

Example

#include <stdio.h>

int main() {

  if( ispunct( '%' ) )
  {
     printf( "Character  % is a punctuation\n" );
  }
  if( ispunct( 'A' ) )
  {
     printf( "Character  A is a punctuation\n" );
  }
  return 0;
}

It will proiduce following result:

Character  % is a punctuation


previous Printer Friendly

Advertisements


  

Advertisements