Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Character Array X initialized to {a, b, c, d, e, f, g, h, i, j, k, l, m, A, B, C

ID: 3806670 • Letter: C

Question

Character Array X initialized to {a, b, c, d, e, f, g, h, i, j, k, l, m, A, B, C, D, E, F, G, H, I, J, K, L, M}; Pointer Xptr refers to the first element of X array and has a value 124FFBC. Each element is represented by 16 bit uni-code. Memory is byte organized. What the address locations of elements: c, f, and m in the above? Specify in the hex decimal notation a) Hex Addresses of elements: c____f___m b) Using Array X of part (a) above, what are the Hex Address of C, F, and M .b)Hex Addresses of elements: C___F__M____

Explanation / Answer

Each char takes 16 bits of memory, so of a is at 124ffbc, then

Adress of c: As the location of c is 2 places after location of a,

(124ffbc)Hex + (16*2)Decimal = (124ffbc)Hex + (20)Hex = (124ffdc)Hex

Adress of f:

(124ffbc)Hex + (5*16)Decimal = (124ffbc)Hex + (50)Hex = (125000c)Hex

Adress of m:

(124ffbc)Hex + (12*16)Decimal = 124ffbc + C0 = (125007c)Hex

Adress of C:

(124ffbc)Hex + (15*16)Decimal = (124ffbc)Hex + (F0)Hex = (12500ac)Hex

Adress of F:

(124ffbc)Hex + (18*16)Decimal = 124ffbc + (120)Hex = (12500dc)Hex

Adress of M:

(124ffbc)Hex + (25*16)Decimal = 124ffbc + 190 = (125014c)Hex