Introduction to Computer Systems Chapter 13

Introduction to Computer Systems Chapter 13 - Chapter 13...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 13 13.1. Name Type Offset Scope operand1 int 0 main operand2 int -1 main operation char -3 main result int -2 main 13.3. if (a) x = b; else x = c; 13.5. AND R0, R0, #0 ; init r0 at 0 LDR R1, R5, #0 BRz CASE_1 ; compare x==0 ADD R1, R1, #-1 BRz CASE_2 ; compare x==1 BR CASE_DEF ; goto default case CASE_1: ADD R1, R0, #3 STR R1, R5, #-1 ; y = 3 CASE_2: ADD R1, R0, #4 STR R1, R5, #-1 ; y = 4 BR END_SWITCH ; break CASE_DEF: ADD R1, R0, #5 STR R1, R5, #-1 ; y = 5 BR END_SWITCH ; break END_SWITCH: . . . 13.7. This if-else statement cannot be converted into a switch statement. All cases labels must be integral constants. The if conditional (x == y) cannot be converted into a case label for the switch. 13.9. a. 0 b. 0 c. 11 4
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
13.11. #include <stdio.h> #define TRUE 1 #define FALSE 0 int main() { char nextChar; /* Next character in email address */ int gotAt = FALSE; /* Indicates if At @ was found */ int gotDot = FALSE; /* Indicates if Dot . was found */ int charCount = 0; printf("Enter your email address: ");
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Introduction to Computer Systems Chapter 13 - Chapter 13...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online