Home Segments Index Top Previous Next

705: Mainline

The i specification is for reading integers of type int. The hi specification is for reading integers of type short.

The following program reads integers of type short and of type int:

short sample_short; 
int sample_int; 
scanf ("%hi%i", &sample_short, &sample_int); 
printf ("The short is %i; the int is %i\n", 
                      sample_short,  sample_int); 
--- Data ---
32000 128000 
--- Result --- 
The short is 32000; the int is 128000