当我调用这个函数时,它总是返回 false 并停止程序。但我不知道为什么。
// checks to see if the second argument is a positive interger,
// and that there is only one arg
if (ArgCheck (argc, shift) == false)
{
printf("You may only input one non-negative argument.\n");
return 1;
}
else
return true;
功能ArgCheck
是:
int ArgCheck (int a, int b)
{
if (a > 2)
{
return false;
}
else if (b < 0)
{
return false;
}
else
return 0;
}
即使我在命令行中输入正确的参数,它仍然返回 false。我知道这是一个菜鸟问题,但我感谢您的帮助。
谢谢。