Answers for "isnumber function in c"

C
4

c string is int

int isNumber(char s[])
{
    for (int i = 0; s[i]!= '\0'; i++)
    {
        if (isdigit(s[i]) == 0)
              return 0;
    }
    return 1;
}
Posted by: Guest on October-25-2020
0

how to know a type of a numbe in c

int num;
char term;
if(scanf("%d%c", &num, &term) != 2 || term != '\n')
    printf("failure\n");
else
    printf("valid integer followed by enter key\n");
Posted by: Guest on April-02-2021

Code answers related to "C"

Browse Popular Code Answers by Language