Here is the text with correct line breaks, indentation, and spacing:
The first line of output shows that using a %e specifier does not convert an integer to a floating-point number. Consider, for example, what happens when you try to print n3 (type long) using the %e specifier. First, the %e specifier causes printf() to expect a type double value, which is an 8-byte value on this system. When printf() looks at n3, which is a 4-byte value on this system, it also looks at the adjacent 4 bytes. Therefore, it looks at an 8-byte unit in which the actual n3 is embedded. Second, it interprets the bits in this unit as a floating-point number. Some bits, for example, would be interpreted as an exponent. So even if n3 had the correct number of bits, they would be interpreted differently under %e than under %ld. The net result is nonsense.
The first line also illustrates what we mentioned earlier—that float is converted to double when used as arguments to printf(). On this system, float is 4 bytes, but n1 was expanded to 8 bytes so that printf() would display it correctly.
The second line of output shows that printf() can print n3 and n4 correctly if the correct specifier is used.
The third line of output shows that even the correct specifier can produce phony results if the printf() statement has mismatches elsewhere. As you might expect, trying to print a floating-point value with an %ld specifier fails, but here, trying to print a type long using %ld fails! The problem lies in how C passes information to a function. The exact details of this failure are implementation dependent, but the sidebar “Passing Arguments” discusses a representative system.
Passing Arguments
The mechanics of argument passing depend on the implementation. This is how argument passing works on one system. The function call looks as follows:
Click here to view code image
printf("%ld %ld %ld %ld\n", n1, n2, n3, n4);
This call tells the computer to hand over the values of the variables n1, n2, n3, and n4 to the computer. Here’s one common way that’s accomplished. The program places the values in an