How to printf long long?

When compiling with Mingw 32bit, the size of long and unsigned long is 4 bytes, the size of long long and unsigned long long is 8 bytes.

  • To print a long integer, the format of printf is “%ld”.
  • To print an unsigned long integer, the printf format is “%lu”.
  • To printf a long long integer, you should use “%lld” as the format of printf.
  • To display an unsigned long long integer, the print format string you should use is “%llu”.

If you use “%lu” to display an unsigned  long long integer, you may get “0” output, which is not you want.

reference:https://stackoverflow.com/questions/38561/what-is-the-argument-for-printf-that-formats-a-long

https://stackoverflow.com/questions/2844/how-do-you-format-an-unsigned-long-long-int-using-printf

 

Did you like this?
Tip admin with Cryptocurrency

Donate Bitcoin to admin

Scan to Donate Bitcoin to admin
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to admin

Scan to Donate Bitcoin Cash to admin
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to admin

Scan to Donate Ethereum to admin
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to admin

Scan to Donate Litecoin to admin
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to admin

Scan to Donate Monero to admin
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to admin

Scan to Donate ZCash to admin
Scan the QR code or copy the address below into your wallet to send some ZCash:

Leave a Reply