Format specifier for printing a bitfield in a structure in hexadecimal notation in c
I have the following structure
struct data {
uint64_t addr:50;
};
If I want to print the value addr
in hexadecimal decimal format, which should I use the format specifier?
+3
Chinna
source
to share
1 answer
You have to do this in two steps: first create a complete variable uint64_t
with a copy addr
, then print it with "%" PRIx64
.
+1
John Zwinck
source
to share