Exercise 2
Name _______________________
Points __/22
1. (16) Declare the following:
- an 8-bit variable named a1 initialized to 'A',
- an 8-bit variable named b1 initialized to 100011012,
- a zero-terminated string variable named c1 initialized to your
first name,
- a 16-bit variable named d1 initialized to your age,
- a 16-bit array variable named e1 of 20 values initialized to all
zeroes,
- a 32-bit variable named f1 initialized to the current USA
population,
- a signed 16-bit variable named g1 initialized to the most
negative 16-bit value,
- a 32-bit real variable named h1 initialized to pi,
2. (6 points) Assume each variable defined below starts at offset 00000000.
List the individual bytes as they would be arranged in memory, lowest to highest
offset, for the following definitions:
a) 2a byte 1, 2, 3, 4, 5
b) 2b
word 1, 2, 3, 4, 5
c) 2c dword
1, 2, 3, 4, 5