newbie: format for unsigned long long (c99)

Discussion in 'C Programming' started by TK, Dec 9, 2005.

  1. TK

    TK Guest

    Hi,

    which format can I use for type

    unsigned long long

    in printf()?

    o-o

    Thomas
     
    TK, Dec 9, 2005
    #1
    1. Advertisements

  2. TK

    Jordan Abel Guest

    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.
     
    Jordan Abel, Dec 9, 2005
    #2
    1. Advertisements

  3. 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) <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.
     
    Keith Thompson, Dec 9, 2005
    #3
  4. TK

    TK Guest

    Thanks for help!

    o-o

    Thomas
     
    TK, Dec 10, 2005
    #4
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    982
    Eric Sosman
    Jul 8, 2003
  2. Replies:
    1
    Views:
    623
    Diez B. Roggisch
    Jun 1, 2005
  3. sridhar

    comparing unsigned long and unsigned int

    sridhar, Nov 1, 2004, in forum: C Programming
    Replies:
    6
    Views:
    716
    J. J. Farrell
    Nov 3, 2004
  4. Daniel Rudy

    unsigned long long int to long double

    Daniel Rudy, Sep 19, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,583
    Peter Shaggy Haywood
    Sep 20, 2005
  5. Replies:
    3
    Views:
    4,177
    Chris Torek
    Feb 20, 2006
  6. CFAN
    Replies:
    6
    Views:
    1,143
    Tor Rustad
    Apr 4, 2007
  7. Sebastian Faust

    warning: use of C99 long long integer constant

    Sebastian Faust, Apr 1, 2008, in forum: C Programming
    Replies:
    23
    Views:
    3,694
    Philip Potter
    Apr 2, 2008
  8. pozz
    Replies:
    12
    Views:
    1,074
    Tim Rentsch
    Mar 20, 2011
Loading...