Function name : ispunct
Header file : <ctype.h>
Function prototype : int ispunct(int ch);
Function : Determine whether a character is a punctuation mark
Parameters : int ch character to be checked
Return value : If ch is not a punctuation mark, return 0; if ch is a punctuation mark, return non-0
Program example : Determine whether the entered character is a punctuation mark
#include<ctype.h>#include<stdio.h>intmain(){charch;printf(inputacharacter:);scanf(%c,&ch);if(ispunct(ch)){printf(%cispunct.,ch) ;}else{printf(%cisnotpunct.,ch);}putchar('n');return0;}
Running results:
inputacharacter:,,ispunct.