## Exercises2.8Exercises

###### 1.

Say you want to allocate an area in memory for storing any number in the range $0$—$4,000,000,000\text{.}$ This memory area will start at location $\hex{2fffeb96}\text{.}$ Give the addresses of each byte of memory that will be required.

Hint

Convert $4,000,000,000$ to hexadecimal to determine how many bytes are required to store the largest number.

Four bytes are sufficient to store an unsigned integer up to $4,294,967,295$ so we would need to allocate the memory bytes at $\hex{2fffeb96}\text{,}$ $\hex{2fffeb97}\text{,}$ $\hex{2fffeb98}\text{,}$ and $\hex{2fffeb99}\text{.}$

###### 2.

You need to allocate an area in memory for storing an array of 30 bytes. The first byte will have the value $0$ stored in it, the second $1\text{,}$ the third $2\text{,}$ etc. This memory area will start at location $\hex{00100e}\text{.}$ Show what this area of memory looks like.

 $\hex{00100e}\text{:}$ $\hex{00}$ $\hex{00100f}\text{:}$ $\hex{01}$ $\hex{001010}\text{:}$ $\hex{02}$ $\hex{001011}\text{:}$ $\hex{03}$ $\cdots$ $\cdots$ $\hex{00102a}\text{:}$ $\hex{1c}$ $\hex{00102b}\text{:}$ $\hex{1d}$
If we started with zero in the decimal number system we would use a 9' to represent the tenth item. How would you represent the eleventh item in the decimal system?
$\hex{10}_{16}\text{,}$ which is 0x10` in C/C++ syntax.