Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print string with `%016llx`

Tags:

c

gcc

printf

Sorry for the probably basic question, but I'm trying to understand some code and I can't understand what this (%016llx) placeholder means.

I understand that %x is HEX coding, and to the best of my knowledge the numbers in between should be the number of digits and the 0 padding; but I cannot decode the 016ll sequence, and googling didn't helped so much more than showing an example in which it was somehow related to gcc.

Given that I'm a nearly-zero-experience programmer, can you help me?

like image 971
clabacchio Avatar asked Apr 30 '26 19:04

clabacchio


1 Answers

The description of fprintf() in the C99 Standard tells us that the %016llx conversion specification is made up of

  1. the mandatory % character
  2. a 0 flag for padding
  3. the 16 as "minimum field width"
  4. the ll as "length modifiers"
  5. the x conversion specifier

So, in whole it means to write a unsigned long long int in hexadecimal notation occupying a minimum of 16 positions, padded with 0.

like image 117
pmg Avatar answered May 03 '26 08:05

pmg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!