Format specifier for 'long long'

前端 未结 7 738
野性不改
野性不改 2021-02-02 07:05

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?

<
7条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-02 07:22

    This one and even little more has been described here: cross-platform printing of 64-bit integers with printf

    TL;DR: You can use PRId64 macro (from inttypes.h) to print 64 bit integers in decimal in a semi-portable way. There are also other macros (like PRIx64).

提交回复
热议问题