【求助】标准函数isdigit()的返回值,有可能是非1且非0吗? 书上说,如果参数是数字字符的话,就是非0值。而且暗示可能不一定是1。 但是我试了十个数字字符,都是1。 书上为什么要这么说呢?是不是还有别的考虑?如果有,那是什么考虑呢? 书是:《the c programming language》 [解决办法] 因为: RETURN VALUE The values returned are non-zero if the character c falls into the tested class, and a zero value if not. 只要判断函数返回值是否为0就可以了。 [解决办法]
[解决办法] 这个可以参考MSDN上面关于isdigit的一段解释: The result of the test condition for the isdigit function depends on the LC_CTYPE category setting of the current locale; see setlocale for more information. For iswdigit, the result of the test condition is independent of locale.