if (a != b) if (a < b) statement; else statement;
int i; scanf("%d", i); /* The '&' was "accidentally" left out before the i */
Include code in your response that demonstrates three such problems. Does the compiler help to catch these problems? Describe any indication the compiler gives you that there might be a problem. In light of our discussion in class on the implementation details of function calls and parameter passing, explain what actually happens when your code executes.
Assume the CPU registers have the following hexadecimal values:Seg:Off | 0 1 2 3 4 5 6 7 8 9 A B C D E F ----------|------------------------------------------------ 0000:0000 | 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0000:0010 | 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 0000:0020 | 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 0000:0030 | 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
What will the values for registers ax, bx, cx, and dx be in hexadecimal after executing the following sequence of memory referencing instructions? (Hint: This can be very tricky, so watch out! Pay attention to segment registers, endian behavior, and operand sizes. Review the section Referencing Memory in the document 8086 Assembly Language for help.)AX:0000 BX:0002 CX:0000 DX:0000 SI:0001 DI:0000 BP:0002 DS:0001 ES:0002 SS:0000 CS:0000 SP:FFFE IP:0100
mov ax, [bx+2] dec word [bx+2] mov bh, [bx+3] mov cx, [bp+si-3] mov dx, [es:bp+2]