These answers are really confusing, I would suggest an easy way to understand.
Hexadecimal base is 16
0x11 is 011 (simply remove x)
For 011 we have 3 digits right?
If we start from 0th position, these digits are:
0th position(0 in 011),
1st position (1 in 011)
and 2nd position(again 1 in 011)
take positions in reverse order: 2,1,0
the calculation part
16^2 * value at first position(0th) = 16^2 * 0 = 0
16^1 * value at second position (1st) = 16^1 * 1 = 16
16^0 * value at third position (2nd) = 16^0 * 1 = 1
adding all these answers will get 0 + 16 + 1 = 17
8条答案
按热度按时间kuarbcqp1#
就像“11”在基数10中表示“110”和“111”一样,“11”在基数16(即十六进制)中表示“116”和“111”--或者17在基数10中。
p5fdfcr12#
数字开头的
0x
表示编译器将以十六进制读取它。0x11
=1 * 16 + 1 = 17
of1yzvn43#
0x11 = 116^1 + 116^0 = 17(就像17 = 1 * 10^1 + 7 * 10^0一样)。
dwbf0jvd4#
十六进制计数为16位,而不是10位。为了说明额外的6位数,它使用字母
A
到F
。从16进制和10进制的0开始计数:
此外,要从基数16转换为基数10:
1116 = 1 * 16 + 1 = 1710
whhtz7ly5#
就像:
xfb7svmp6#
嗯,也许是因为0x11是十进制的17?
wr98u20j7#
下面是一种简单的查看方法
128 64 32 16 8 4 2 1 =...的十进制值
0 0 0 1 0 0 0 1 =打开或关闭的布尔开关
把它们加在一起16 + 1 = 17
k10s72fa8#