ispunct() function in C Last Updated : 16 Dec, 2021 Comments Improve Suggest changes 13 Likes Like Report The ispunct() function checks whether a character is a punctuation character or not. The term "punctuation" as defined by this function includes all printable characters that are neither alphanumeric nor a space. For example '@', '$', etc. This function is defined in ctype.h header file. syntax: int ispunct(int ch); ch: character to be checked. Return Value : function return nonzero if character is a punctuation character; otherwise zero is returned. CPP // Program to check punctuation #include <stdio.h> #include <ctype.h> int main() { // The punctuations in str are '!' and ',' char str[] = "welcome! to GeeksForGeeks, "; int i = 0, count = 0; while (str[i]) { if (ispunct(str[i])) count++; i++; } printf("Sentence contains %d punctuation" " characters.\n", count); return 0; } Output: Sentence contains 2 punctuation characters. CPP // C program to print all Punctuations #include <stdio.h> #include <ctype.h> int main() { int i; printf("All punctuation characters in C" " programming are: \n"); for (i = 0; i <= 255; ++i) if (ispunct(i) != 0) printf("%c ", i); return 0; } Output: All punctuation characters in C programming are: ! " # $ % & ' ( ) * +, - . / : ; ? @ [ \ ] ^ _ ` { | } ~ Create Quiz Comment S Shivani Ghughtyal 13 Improve S Shivani Ghughtyal 13 Improve Article Tags : C Language C-Library Explore C BasicsC Language Introduction6 min readIdentifiers in C3 min readKeywords in C2 min readVariables in C4 min readData Types in C3 min readOperators in C8 min readDecision Making in C (if , if..else, Nested if, if-else-if )7 min readLoops in C6 min readFunctions in C5 min readArrays & StringsArrays in C4 min readStrings in C5 min readPointers and StructuresPointers in C7 min readFunction Pointer in C5 min readUnions in C3 min readEnumeration (or enum) in C5 min readStructure Member Alignment, Padding and Data Packing8 min readMemory ManagementMemory Layout of C Programs5 min readDynamic Memory Allocation in C7 min readWhat is Memory Leak? How can we avoid?2 min readFile & Error HandlingFile Handling in C11 min readRead/Write Structure From/to a File in C3 min readError Handling in C8 min readUsing goto for Exception Handling in C4 min readError Handling During File Operations in C5 min readAdvanced ConceptsVariadic Functions in C5 min readSignals in C language5 min readSocket Programming in C8 min read_Generics Keyword in C3 min readMultithreading in C9 min read Like