C printf type prefix

Type prefixes: h

Appear before type indicators d, i, o, u, x, and X. Display the value as short, for example, short integer (hd) and short unsigned integer (hu).


#include <stdio.h>
main()/* www. java  2  s .c om*/
{
    int f = 9999;
    printf(" %hu \n",f);
}

The code above generates the following result.

Type prefixes: l (lower case l)

appear before type-identifiers d, i, o, u, x, and X. display value as long, for example, long integer (ld) and long unsigned integer (lu).


#include <stdio.h>
/* w ww  . j  av  a  2s. c om*/
main(){
    int f = 999999999;
    printf(" %lu \n",f);
}

The code above generates the following result.

Type prefixes: L (upper case L)

Available for type-identifiers e, E, f, g, and G. Display value as long double.


#include <stdio.h>
main()/* ww  w . ja  v a  2 s .  com*/
{
    long double f = 9999.999;
    printf(" %LG \n",f);
}

The code above generates the following result.





















Home »
  C Language »
    Input / Output »




printf
scanf