Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

check command line input is a number in c

bool isNumber(char number[])
{
    int i = 0;

    //checking for negative numbers
    if (number[0] == '-')
        i = 1;
    for (; number[i] != 0; i++)
    {
        //if (number[i] > '9' || number[i] < '0')
        if (!isdigit(number[i]))
            return false;
    }
    return true;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #command #line #input #number
ADD COMMENT
Topic
Name
6+3 =