# Chapter 2-p - Example 2.1 Representation of integer...

This preview shows pages 1–2. Sign up to view the full content.

Example 2.1 Representation of integer constants on a 16-bit computer. The program in Fig.2.9 illustrates the use of integer constants on a 16-bit machine. The output in figure 2.3 shows that the integer values larger than 32767 are not properly stored on a 16-bit machine. However, when they are qualified as long integer (by appending L), the values are correctly stored. INTEGER NUMBERS ON 16-BIT MACHINE Program main() { printf("Integer values\n\n"); printf("%d %d %d\n", 32767,32767+1,32767+10); printf("\n"); printf("Long integer values\n\n"); printf("%ld %ld %ld\n", 32767L,32767L+1L,32767L+10L); } Ou tput Integer values 32767 -32768 -32759 Long integer values 32767 32768 32777 Fig. 2.3 Representation of integer constants Example 2.2 Program in Figure 2.8 shows typical declarations, assignments and values stored in various types of variables. The variables x and p have been declared as floating-point variables. Note that the way the value of 1.234567890000 that we assigned to x is displayed under different output formats. The value of x is displayed as 1.234567880630 under %.12lf format, while the actual value assigned is 1.234567890000.

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

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

{[ snackBarMessage ]}

### Page1 / 5

Chapter 2-p - Example 2.1 Representation of integer...

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

View Full Document
Ask a homework question - tutors are online