This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ple, the expression a && 5/a will never cause a division by zero, and the expression p && *p++ will never cause the dereferencing of a null pointer. Practice Problem 2.9:
Suppose that x and y have byte values 0x66 and 0x93, respectively. Fill in the following table indicating the byte values of the different C expressions 40 CHAPTER 2. REPRESENTING AND MANIPULATING INFORMATION
Expression x&y x|y ˜x | ˜y x & !y Value Expression x && y x || y !x || !y x && ˜y Value Practice Problem 2.10:
Using only bit-level and logical operations, write a C expression that is equivalent to x == y. That is, it will return 1 when x and y are equal and 0 otherwise. 2.1.10 Shift Operations in C
C also provides a set of shift operations for shifting bit patterns to the left and to the right. For an operand x having bit representation ÜÒ ½ ÜÒ ¾ Ü¼ , the C expression x << k yields a value with bit representation ÜÒ ½ ÜÒ ¾ Ü¼ ¼ ¼ . That is, x is shifted bits to the left, dropping off the most signiﬁcant bits and ﬁlling the le...
View Full Document
- Spring '10
- The American