📌  相关文章
📜  检查命令行输入是否为数字 - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:42.355000             🧑  作者: Mango

代码示例1
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;
}