What is the purpose of format specifier “%qd” in `printf()`?

后端 未结 3 1338
心在旅途
心在旅途 2021-02-18 17:24

I saw format specifier %qd when browsing github code. Then I checked in GCC compiler, it\'s working fine.

#include 

int main()
{  
          


        
3条回答
  •  伪装坚强ぢ
    2021-02-18 17:59

    q means quad word format specifier in printf function which is used to handle 64 bits comfortably on all machines.

    From Wikipedia:

    Additionally, several platform-specific length options came to exist prior to widespread use of the ISO C99 extensions:

    q - For integer types, causes printf to expect a 64-bit (quad word) integer argument. Commonly found in BSD platforms

提交回复
热议问题