📌  相关文章
📜  c 检查参数是否为整数 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:08.208000             🧑  作者: 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;
}