324_Book

# 2 gives

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: \n", u, u); When run on a 32-bit machine it prints the following: x = 4294967295 = -1 u = 2147483648 = -2147483648 In both cases, printf prints the word ﬁrst as if it represented an unsigned number and second as if it represented a signed number. We can see the conversion routines in action: Ì¾Í ¿¾ ´ ½µ ÍÅ Ü ¿¾ ¿½ ¿½ ¿¾ ¿½ ¾ ¾ and Í¾Ì ¿¾ ´¾ µ ¾ ¾ ¾ ÌÅ Ò ¿¾. Some peculiar behavior arises due to C’s handling of expressions containing combinations of signed and unsigned quantities. When an operation is performed where one operand is signed and the other is unsigned, C implicitly casts the signed argument to unsigned and performs the operations assuming the numbers are nonnegative. As we will see, this convention makes little difference for standard arithmetic operations, but it leads to nonintuitive results for relational operators such as < and >. Figure 2.13 shows some sample relational expressions and their resulting evaluations, as...
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