gpt4 book ai didi

c - K&R C 处理八进制

转载 作者:太空狗 更新时间:2023-10-29 15:55:06 24 4
gpt4 key购买 nike

所以,首先我阅读了以下内容: 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com