tags:

views:

917

answers:

7

I declare a variable for a 64 bit counter as :

long long call_count;

What is the format specifier that I should use in print statements?

I tried, %l, %ld, %ll. None seems to be correct.

I use Diab C compiler for compiling my application code to run on pSOS operating system.

A: 

did this a long time ago... maybe %L or %Ld worked then. sorry, but i can't test that.

kinjal
`L` is the length modifier for the long double type
Christoph
+7  A: 

It's "%lli" (or equivalently "%lld")

Christoph
+2  A: 

Maybe %lld? I think this is the format for gcc, don't know anything about Diab C compiler.

%lld is the Standard conversion specifier for long long, Windows is the only one I am aware of that doesn't support this (but they don't support a lot of standards). Also, this is specific to the standard c library being used, not the compiler.
Robert Gamble
+1  A: 

isn't it supposed to be %lld?

Petesh
+1  A: 

Microsoft and Watcom use %I64d (capital eye), others use %lld (lowercase ell ell).

Graeme Perrow
"use %I64d (capital I)": try again?
Robert Gamble
Microsoft uses ll (ell ell) for long long; I64 (eye) for __int64. http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx
Rob Kennedy
Clarified. Thanks
Graeme Perrow
+3  A: 

According to C99, it should be "%lld" (see, for example,here). If Diab C isn't C99, then you'd have to look at the compiler docs, which I can't seem to find online with a quick Googling.

Bdoserror
A: 

It is %lld for signed and %llu for unsigned

Gerhard