second problem of chapter 4, on reversing arrays