C Isdigit() - C Standard Library - Programiz
Có thể bạn quan tâm
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.Từ khóa » Thư Viện Isdigit
-
Hàm Isdigit() Trong C Thư Viện C Chuẩn - Hoclaptrinh
-
Hàm Isdigit() Trong C | Thư Viện C Chuẩn
-
Hàm Isdigit() Trong C / C++ - Freetuts
-
Hàm Isdigit() Kiểm Tra Kí Tự Là Kiểu Số | VnCoding
-
Hàm Isdigit() Trong Python - Học Lập Trình Python - VietTuts
-
Ctype.h Trong C
-
Ngôn Ngữ C - Bài 36 - Kiểm Tra Chuổi Dùng Lệnh Isdigit Trong Thư Viện ...
-
Thư Viện Các Hàm Trong C Ppt - Tài Liệu Text - 123doc
-
4.1. Thư Viện Chuẩn Là Gì - Lập Trình Tân Binh
-
Ctype.h Trong C - Vay Tiền Online Bằng CMND
-
Tại Sao Thư Viện C Sử Dụng Macro Và Hàm Có Cùng Tên? Cập Nhật ...
-
Kiểu Dữ Liệu Chuỗi Trong Python - Phần 5
-
Các Hàm Kiểm Tra Tính đúng đắn Của Việc Nhập Xuất Trên Arduino