This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 94,967,295 41 Figure 2.8: C Integral Data types. Text in square brackets is optional. 2.2 Integer Representations
In this section we describe two different ways bits can be used to encode integers—one that can only represent nonnegative numbers, and one that can represent negative, zero, and positive numbers. We will see later that they are strongly related both in their mathematical properties and their machine-level implementations. We also investigate the effect of expanding or shrinking an encoded integer to ﬁt a representation with a different length. 2.2.1 Integral Data Types
C supports a variety of integral data types—ones that represent a ﬁnite range of integers. These are shown in Figure 2.8. Each type has a size designator: char, short, int, and long, as well as an indication of whether the represented number is nonnegative (declared as unsigned), or possibly negative (the default). The typical allocations for these different sizes were given in Figure 2.2. As indicated in Figure 2...
View Full Document
- Spring '10
- The American