Consider however the case where xp and yp are equal

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: ted type value in a switch statement. Recall that enumerated types in C are simply a way to introduce a set of names having associated integer values. By default, the values assigned to the names go from 0 upward. In our code, the actions associated with the different case labels have been omitted. /* Enumerated type creates set of constants numbered 0 and upward */ typedef enum {MODE_A, MODE_B, MODE_C, MODE_D, MODE_E} mode_t; int switch3(int *p1, int *p2, mode_t action) { 196 int result = 0; switch(action) { case MODE_A: case MODE_B: case MODE_C: case MODE_D: case MODE_E: default: } return result; } CHAPTER 3. MACHINE-LEVEL REPRESENTATION OF C PROGRAMS The part of the generated assembly code implementing the different actions is shown shown in Figure 3.36. The annotations indicate the values stored in the registers and the case labels for the different jump destinations. A. What register corresponds to program variable result? B. Fill in the missing parts of the C code. Watch out for cases...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online