[prev] 7 [next]

Rendering C in MIPS: Conditional Statements (cont)

We can rewrite if statements using simplified C using
  • labels ... symbolic name for C statement
  • goto ... transfer control to labelled statement (Never use goto when writing real C code!!!!)

Standard C                Simplified C
------------------------  ------------------------
                          if_stat:
if (Cond)                   if (!Cond){
   { Statements1 }            goto else_part; 
else                          Statements1
   { Statements2 }            goto end_if;                                   
                            }
                          else_part:
                            Statements2
                          end_if: