This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: WHAT IS RESULT OF &z ? (show work) -- 5pts ANS: &z returns the base address in memory of the array z WHAT IS RESULT OF *(&x) ? (show work) -- 5pts ANS: *(&x) returns the contents of the memory address &x, so *(&x) = 45. WRITE MIPS CODE FOR p = &z ; *p = 99 (2-3 statements) - 10 pts ANS: (1) From the givens, pointer p = &z gets the address of z, so if the base address of z is in $s0, and p is in $t0, then we have the MIPS statement: addi $t0, $s0, 268 # since 268 = 67 * 4 (2) Assuming that the base address of z is in $s0, and p points to z, then *p = 99 means that z 99. So we have: addi $t2, $zero, 99 #put 99 in $t0 sw $t2, 268($s0) #store $t0 in z...
View Full Document
This note was uploaded on 12/10/2011 for the course CDA 3101 taught by Professor Small during the Fall '08 term at University of Florida.
- Fall '08