Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > newbie: format for unsigned long long (c99)

Reply
Thread Tools

newbie: format for unsigned long long (c99)

 
 
TK
Guest
Posts: n/a
 
      12-09-2005
Hi,

which format can I use for type

unsigned long long

in printf()?

o-o

Thomas
 
Reply With Quote
 
 
 
 
Jordan Abel
Guest
Posts: n/a
 
      12-09-2005
On 2005-12-09, TK <> wrote:
> 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.
 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      12-09-2005
TK <> writes:
> 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.)

--
Keith Thompson (The_Other_Keith) kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
TK
Guest
Posts: n/a
 
      12-10-2005
Thanks for help!

o-o

Thomas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(int) -> (unsigned) -> (int) or (unsigned) -> (int) -> (unsigned):I'll loose something? pozz C Programming 12 03-20-2011 11:32 PM
unsigned long long int to long double Daniel Rudy C Programming 5 09-20-2005 02:37 AM
unsigned long to unsigned char ashtonn@gmail.com Python 1 06-01-2005 07:00 PM
comparing unsigned long and unsigned int sridhar C Programming 6 11-03-2004 03:52 AM
Assigning unsigned long to unsigned long long George Marsaglia C Programming 1 07-08-2003 05:16 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57