Added x_is_digit function

This commit is contained in:
xavi 2024-09-22 17:48:21 -07:00
parent 5b3224c60c
commit c69f18a479
2 changed files with 21 additions and 0 deletions

13
x_ctypes/src/x_ctypes.c Normal file
View File

@ -0,0 +1,13 @@
#include <stdio.h>
int x_isdigit(const char x){
if ( x > 48 && x < 57 ){
return 1;
}
else if ( x > 0 && x < 9 ){
return 1;
}
return 0;
}

8
x_ctypes/src/x_ctypes.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef X_CTYPES_H
#define X_CTYPES_H
// returns 0 if x is not a digit and 1 if it is
int x_isdigit(char x);
#endif