# print an array using pointers - faster code that a compiler might produce # p in $t0 # q in $t1 main: la $t0, numbers # int *p = &numbers[0]; addi $t1, $t0, 16 # int *q = &numbers[4]; loop: lw $a0, 0($t0) # printf("%d", *p); li $v0, 1 syscall li $a0, '\n' # printf("%c", '\n'); li $v0, 11 syscall addi $t0, $t0, 4 # p++ ble $t0, $t1, loop # if (p <= q) goto loop; li $v0, 0 # return 0 jr $ra .data numbers: # int numbers[10] = { 3, 9, 27, 81, 243}; .word 3, 9, 27, 81, 243