32 Not 20?

I have watched this lecture about 10 times and read all the comments and still I am confused about one thing, which is annoying because I’m fairly certain I understand the rest of it. I’ll explain my thought process as clearly as possible so maybe someone can show me the light.

At 3:28 Michael says “and then we have another integer down here… hmm I wonder what that is?”

I’m told that the first integer had a value of 8 because “8” is clearly displayed and followed by the bytes that an int32 requires - 08 00 00 00

Following this logic I didn’t see any mystery in the second integer, it has a value of 20, and because its an integer it requires a total of 4 bytes so it is followed by 00 00 00.

BUT WAIT!
Why am I being asked what that integer is when I can see its value right there?
And why is Micheal now telling me that the integer I thought had a value of 20 actually is an integer with a value of 32?

It’s being displayed as a hexadecimal number i.e. base 16. So each “column” is worth increasing powers of 16 not 10.

Here is 101 in decimal

 1      0     1
10^2   10^1  10^0

So

100 * 1 = 100
 10 * 0 =   0
  1 * 1 =   1 

Which is 101 in decimal unsurprisingly
Now in base 16 the number 101

 1      0     1
16^2   16^1  16^0

So that would be

256 * 1 = 256
 16 * 0 =   0
  1 * 1 =   1 

Which is the number 257 in decimal. so 20 in hexadecimal would be 16 * 2 = 32.

Thanks for replying @DanM
Unfortunately your explanation still left me completely clueless.
It’s not your fault, I feel a little embarrassed that I just can’t grasp what it is we are talking about.
I’m not giving up, I really want to put this to rest and move on with the course with confidence. If you could illustrate a little further to clarify what you mean at different stages of your explanation that would be great because my scalp is wearing thin at this point :stuck_out_tongue: . I made notes on what was going through my head as I read through.

Please don’t give up on me.

  1. What is being shown is the number 101 split out into columns denoting what each is worth. 10^1 means 10 to the power of 1 which is 10, 10^2 is 10 to the power of 2 which is 100 and so on and so forth.
  2. Sorry that should have read 10 * 0. That’s what I get for copying and pasting :stuck_out_tongue:
  3. 256 is 16^2
  4. Because it’s using hexadecimal. 10 in binary is 2 in decimal, 10 in hexadecimal is 16 in decimal.

Privacy & Terms