Chapter13solutions

Chapter13solutions - Chapter 13 13.1 Name operand1 operand2...

Info iconThis preview shows pages 1–2. 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.2. a. if (-2) printf("True!"); else printf("False!"); b. "True!" c. The modified code will not behave differently. 13.3. if (a) x = b; else x = c; 13.4. a. Here, the expression (x = 0) always assigns 0 to the variable x. Since this expression as a whole will likewise evaluate to 0, "x does not equal 0" will be printed in all cases. b. When x equals 0: The statement "x equals 0" is displayed. When x equals 1: The statement "x does not equal 0" is displayed. c. When x equals 0: The statement "A" is displayed since the first expression will evaluate to true. When x equals 1: The first three 'if' expressions all evaluate to true, but the fourth, (x), is nonzero and therefore true. In this case, "D" is displayed. d. When x equals 0: The first case is true. All lines of code after the case and before a break statement (or the end of the switch block)are executed. So, “y = 3”; is executed, and then “y = 4”; is executed before the break is encountered. When x equals 1: The second case is true and “y = 4”; is executed before the break; is
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 04/07/2008 for the course ECE 495K taught by Professor Vijaykumar during the Spring '08 term at Purdue.

Page1 / 7

Chapter13solutions - Chapter 13 13.1 Name operand1 operand2...

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

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