开发者

A Byte Array with all 0x00 is Equaled to 0x08?

开发者 https://www.devze.com 2022-12-26 20:57 出处:网络
I think I encountered something extraordinary strange in VS 2008. All the array values are 0x00, but why it is displayed 0x00000008 at t开发者_运维知识库he start of the variable?Visual studio is displ

I think I encountered something extraordinary strange in VS 2008.

All the array values are 0x00, but why it is displayed 0x00000008 at t开发者_运维知识库he start of the variable?


Visual studio is displaying the size of your array (in items) not the value. You have eight bytes in your array denoted by byte[8] in decimal or byte[0x00000008] as a 32-bit hex value.

Right click the window and select Hexadecimal Display to switch to a decimal view of the values. I find the decimal view more workable when dealing with small integer types and you won't get confused by all the extra hex notation (although it depends on your personal preference).


That's the length of the array. Eight elements.


Because it's an array of 8 values, 0 through 7


8 refers to the length of the byte array.


This is the length of the array. Notice that in the first column it's listing the indices - there are eight items in the array. (You could think of it as saying that the value of the array is a bytearray with eight items).

0

精彩评论

暂无评论...
验证码 换一张
取 消