English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
ispunct() function checks whether a character is a punctuation symbol.
The prototype of ispunct() function is:
int ispunct(int argument);
If the character passed to the ispunct() function is a punctuation symbol, it returns a non-zero integer. If not, it returns 0.
In C language programming, char characters are internally treated as integers. This is why ispunct() uses an integer parameter.
The ispunct() function inctype.hDefined in header files.
#include <stdio.h> #include <ctype.h> int main() { char c; int result; c = ':'; result = ispunct(c); if (result == 0) { printf("%c is not a punctuation symbol", c); } else { printf("%c is a punctuation symbol", c); } return 0; }
Output Result
: It is a punctuation symbol
#include <stdio.h> #include <ctype.h> int main() { int i; printf("All punctuation symbols in C:\n"); //traverse all ASCII characters for (i = 0; i <= 127; ++i) if (ispunct(i) != 0) printf("%c ", i); return 0; }
Output Result
All Punctuation Symbols in C: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~