# demonstrate implementation of pointers by an address # register use # - $t0: int *p # - $t1: int i # - $t3: temporary result main: la $t0, answer # p = &answer; lw $t1, 0($t0) # i = *p; move $a0, $t1 # printf("%d\n", i); li $v0, 1 syscall li $a0, '\n' # printf("%c", '\n'); li $v0, 11 syscall li $t2, 27 # *p = 27; sw $t2, 0($t0) # lw $a0, answer # printf("%d\n", answer); li $v0, 1 syscall li $a0, '\n' # printf("%c", '\n'); li $v0, 11 syscall li $v0, 0 # return 0 from function main jr $ra # .data answer: .word 42 # int answer = 42;