2t rue false give nthe followingccode intcall

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: c ros s c alls , if the c aller wants to k eep the value, the c aller needs to s ave it. 2. T rue /False : Give n the following C code : int call... Question Points : 20 Given the following C c ode: int c all (int x ){ if (x ==0) {return 0;} els e {return (x +c all (x ­1));} } The following is the as s embly for this C c ode: c all: addi $s p, $s p, ­8 s w $ra, 4($s p) s w $a0, 0($s p) bne $a0, $0, deeper addi $v0, $0, 0 addi $s p, $s p, 8 jr $ra deeper: addi $a0, $a0,­1 jal c all lw $a0, 0($s p) add $v0, $a0, $v0 lw $ra, 4($s p) jr $ra (True or fals e, this as s embly is equivalent to the C c ode?) (Lec ture 11B) Answer Tru e Fa l s e Correct Feedback The programmer forgot to res et the s tac k pointer on the "deeper" c laus e before the return. It c an be fix ed if y ou add the following ins tr...
View Full Document

Ask a homework question - tutors are online