c. What would be the output of the
statement: printf(“%d”, *mypointer); ?
Since mypointer = &myarray[3]; AND the base address of the array myarray is 56871,
location mypointer
CONTAINS the address: 56871 + 3*2 =
56871 + 6 = 56877.
(Notice also that if we went to location
56889 (location mypointer)
we find:
00000000000000001101111000101101 (on 4-bytes or 36-bits) which equates to 56877).
If we REDIRECT to location 56877 we find 1111110011010110 (on 16-bits). Since the value is negative, we
must compliment (assume a two’s compliment machine):
1111110011010110 =>
0000001100101001 (one’s compliment)
+ 1
1100101010 (two’s compliment)
= -(29 + 28 + 25 + 23
+ 21) = -(512 + 256 + 32 + 8
+ 2) = - 810