0x从哪里来?
可能的重复:
为什么十六进制前缀为 0x?
我刚刚看到我的一个朋友的评论made:
3x12=36
2x12=24
1x12=12
0x12=18
这让我想知道..
为什么他们选择 0x
作为十六进制数字的前缀?这个决定背后有什么历史吗?
Possible Duplicate:
Why are Hexadecimal Prefixed as 0x?
I just saw a comment a friend of mine made:
3x12=36
2x12=24
1x12=12
0x12=18
Which made me wonder..
Why did they choose 0x
as prefix for hexadecimal numbers? Is there any history behind this decision?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为,因为
x
来自于hex
,而0
则表示它是一个数字。I think, because
x
comes fromhex
and0
is to indicate that it is a number.0x
表示该数字可能是十六进制。这适用于 C/C++,也可能适用于其他语言。
他的评论就是个笑话。他从数字 12 的乘法表开始,但是当他到达 0 时,他暗示
0x
不是“0 乘以...”,而是“十六进制”,因此十六进制的 12 是 18以十进制表示。0x
means the number is probably hexadecimal. This applies in C/C++, and probalby otherlanguages.
His comment is a joke. he starts with multiplication tables for the number 12, but when he gets to 0 he implies that
0x
is not "0 multiplied by...", but instead is "hexadecimal" so 12 in hex is 18 in decimal.这是来自 WIKIPEDIA 的关于十六进制数字的笑话。
It's a joke on HEX numbers from WIKIPEDIA.
“0x”表示后面的数字是十六进制的。这是一种明确说明数字是十六进制的方式,并且是 C 编译器和一些汇编器识别的表示法
'0x' means that the number that follows is in hexadecimal. It's a way of unambiguously stating that a number is in hex, and is a notation recognised by C compilers and some assemblers