Writes an Unsigned Integer. Signed integers are with - / + at the front. Unsigned are without

and can only represent positive numbers.

So, this is writing 10 in 32 bits which is overkill… to write the value 10, we’d only need 4 bits… 0000 1010 – The number is even, so the last digit it 0, it needs a 2 ( and the 8 ) to create 10 ( via addition ) so only the 5th and 7th bits are set to 1. We can omit the first 4 for the number.

With a signed integer, you need to allocate the bits used by + or -.

Bit counting is straight forward if you know what to look for.

8 bits to a byte: 0000 0000

If the last one is 1, then the number as a whole is odd. Each bit ( starting from the right )

is in power of 2.

From left to right ( where rightmost is 8th, and leftmost is 1st for sake of example.

They’re typically “read” from right to left )

8th is 2^0 which == 1.

7th is 2^1 == 2

6th is 2^2 == 4

5th is 2^3 == 8

4th is 2^4 == 16

3rd is 2^5 == 32

2nd is 2^6 == 64

1st is 2^7 == 128

How many bits are needed to write the number depends on signed / unsigned, and the total of the number.

If you add ALL 8 bits together: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 == 255. So, if you send an unsigned

int that is 255, you’d need to use 8 bits to send it.

This is how I was taught in other languages, it should be the same here.

Hopefully this is straight-forward…