dimanche 24 janvier 2016

Making the "else if" part of the outer statement according to language semantics?

Say we have the following C statement:

if( cond) 
      if( cond) 
        stat
      else
        stat

where the 'else stat' is part of the inner if statement according to the language semantics. What would I need to do in order to make the 'else stat' be part of the outer if statement? To my knowledge, adding {} after the then and at the end of the if statement to separate them would work. Is this correct? Is there another way of doing this?

Aucun commentaire:

Enregistrer un commentaire