Implemented the first part of exercise 3.4 (memory access).