INF: Changes in scanf() and printf() for Long Types in C

ID Number: Q43809

5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a

MS-DOS | OS/2

Summary:

As of version 5.1 of the Microsoft C Optimizing Compiler and version

1.0 of the QuickC compiler, the scanf() and printf() functions no

longer support the uppercase D, O, and I type characters, which

represented long-integer fields.

Current versions of Microsoft C compilers precede the type characters

in the format portion of the printf() and scanf() functions with an

"l" (lowercase letter "l") to specify long-type fields.

The uppercase "X" format specifier also has been changed; it now

specifies that uppercase letters are to be used when displaying

hexadecimal numbers in a printf() statement.

The following code fragment reads an integer into a variable and then

displays the value of the variable:

int i;

scanf( "%d", &i );

printf( "%d", i );

The following code fragment accepts and displays the value of a long

integer variable:

long i;

scanf( "%ld", &i );

printf( "%ld", i );

Additional reference words: 5.10 6.00 6.00a 6.00ax 7.00