C Isdigit() - C Standard Library - Programiz
Maybe your like
Function Prototype of isdigit()
int isdigit( int arg );Function isdigit() takes a single argument in the form of an integer and returns the value of type int.
Even though, isdigit() takes integer as an argument, character is passed to the function. Internally, the character is converted to its ASCII value for the check.
It is defined in <ctype.h> header file.
C isdigit() Return value
| Return Value | Remarks |
|---|---|
| Non-zero integer ( x > 0 ) | Argument is a numeric character. |
| Zero (0) | Argument is not a numeric character. |
Example: C isdigit() function
#include <stdio.h> #include <ctype.h> int main() { char c; c='5'; printf("Result when numeric character is passed: %d", isdigit(c)); c='+'; printf("\nResult when non-numeric character is passed: %d", isdigit(c)); return 0; }Output
Result when numeric character is passed: 2048 Result when non-numeric character is passed: 0Example: C Program to Check whether a Character Entered by User is Numeric Character or Not
#include <stdio.h> #include <ctype.h> int main() { char c; printf("Enter a character: "); scanf("%c",&c); if (isdigit(c) == 0) printf("%c is not a digit.",c); else printf("%c is a digit.",c); return 0; }Output
Enter a character: 8 8 is a digit.Tag » What Is 0 In C
-
What Is \0 In C Language And What Is It's Use? (with Example Please).
-
Objective C - What Does \0 Stand For? - Stack Overflow
-
What Is Use Of \0 In The C Programming Language? - Quora
-
How Does The -'0' And +'0' Work In C? - DaniWeb
-
Difference Between NULL Pointer, Null Character ('') And '0' In C With ...
-
What Does Return 0 Do In C? - Linux Hint
-
C Programming Course Notes - Decisions And Branching
-
What Is The Use Of A '\0' Character In C Language? - Youth4work
-
C : Value Of An Integer N Is 1,0 And -1 For The Value Of M - W3resource
-
Different Ways To Write Zero In C - Teaching
-
ERR30-C. Take Care When Reading Errno
-
C Logical Operators | Microsoft Learn
-
NULL Pointer V/s Null Character ('\0') V/s '0' In C - CodesDope