所以,首先我阅读了以下内容: http://www.hpc.unimelb.edu.au/nec/g1af02e/chap1.html它告诉我以下内容:
K&R C and SUPER-UX K&R C The digits 8 and 9 are allowed. They are considered decimal integer constants.
我有点困惑...寻找更多...发现这个:http://docs.oracle.com/cd/E19205-01/819-5265/bjbfb/index.html
它告诉我:
Accepts 8 or 9 in octal escape sequences.
但是,根据:http://en.wikipedia.org/wiki/Octal
The octal numeral system, or oct for short, is the base-8 number system, and uses the digits 0 to 7.
现在我真的很困惑。我从来没有机会真正使用 K&R C 编译器……那么为什么 K&R C 接受 8 和 9 作为八进制数字……这是如何处理的?它们在“真正的”八进制系统中的值(value)是什么?
最佳答案
K&R C 不是很严格,所以很多 ANSI-C(和更新的)编译器不允许的东西都被允许了。
“八进制”数字 0193
相当于 1*8^2 + 9*8^1 + 3
。可憎之物?是的。
关于c - K&R C 处理八进制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19901347/