codescracker


c

C isdigit()



« Previous Chapter Next Function »


isdigit()

The isdigit() function returns non-zero if ch is a digit, that is, 0 through 0. Otherwise zero is returned.

isdigit() Syntax

Following is the syntax of the isdigit() function :

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

isdigit() Example

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

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

« Previous Chapter Next Function »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test