codescracker


c

C ispunct()



« Previous Chapter Next Function »


ispunct()

The ispunct() function returns non-zero if ch is a punctuation character; otherwise zero is returned. The term "punctuation", as defined by this function, includes all printing characters that are neither alphanumeric nor a space.

ispunct() Syntax

Following is the syntax of the ispunct() function :

#include<ctype.h>
int ispunct(int ch);

ispunct() Example

Following program checks each character read from stdin and reports all punctuation :

#include<ctype.h>
#include<stdio.h>
#include<conio.h>
void main()
{
	clrscr();
	char ch;
	for(; ;)
	{
		ch = getchar();
		if(ispunct(ch))
			printf("%c is punctuation\n", ch);
		if(ch == '.')
			break;
	}
	getch();
}

« Previous Chapter Next Function »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test