This documentation is copyright © 1998-2001 Sandro Sigala <sandro@sigala.it>.
All rights reserved.

Released under the GNU General Public License.

Return to index Return to header Previous symbol Next symbol

isdigit

Prototype

#include <ctype.h>

int isdigit(int c);

Description

Returns a true value if the c character is a decimal-digit character.

Example

View source
#include <ctype.h>

/*
 * Return a true value if the argument string is a regular
 * decimal number.
 */
int is_number(const char *s)
{
    const char *sp;
    for (sp = s; *sp != '\0'; ++sp)
	if (!isdigit(*sp))
	    return 0;
    return sp > s;
}

References

ISO C 9899:1990 7.3.1.4