How to display hexadecimal numbers in C?

Try:

printf("%04x",a);
  • 0 – Left-pads the number with
    zeroes (0) instead of spaces, where
    padding is specified.
  • 4 (width) – Minimum number of
    characters to be printed. If the
    value to be printed is shorter than
    this number, the result is right justified
    within this width by padding on the left
    with the pad character. By default this is
    a blank space, but the leading zero we used
    specifies a zero as the pad char.
    The value is not truncated even if the result is
    larger.
  • x – Specifier for hexadecimal
    integer.

More here

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)