newbie: format for unsigned long long (c99)

J

Jordan Abel

which format can I use for type unsigned long long in printf()?

there's %llu, %llx, %llo. same other format modifiers apply as to plain
format %u %x %o.
 
K

Keith Thompson

TK said:
which format can I use for type

unsigned long long

in printf()?

In C99, you can apply the "ll" modifier to a following 'd', 'i', 'o',
'u', 'x', 'X', or 'n'. For example:

unsigned long long var = ...;
printf("var = %llu\n", var);

But note that support for C99 is not universal, and it's not uncommon
for a compiler to support long long, but for the runtime library not
to support "ll". (For example, gcc supports long long, but it uses
whatever runtime library is provided by the system.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top