Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Format specifier for 'long long'

Tags:

c

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.

like image 254
Prabhu. S Avatar asked Jan 20 '09 17:01

Prabhu. S


People also ask

What is format specifier for long double?

For long double you should use format "%Lf" .

How do I print long long int?

Printing short, long, long long, and unsigned Types To print an unsigned int number, use the %u notation. To print a long value, use the %ld format specifier. You can use the l prefix for x and o, too. So you would use %lx to print a long integer in hexadecimal format and %lo to print in octal format.

What is %U in printf?

In the printf statement when %u is used to print the value of the char c, then the ASCII value of 'a' is printed.

What is specifier for long double in C?

%Lf format specifier for long double %lf and %Lf plays different role in printf. So, we should use %Lf format specifier for printing a long double value.


1 Answers

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.

like image 185
Bdoserror Avatar answered Sep 24 '22 08:09

Bdoserror