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

  • A+
Category:Languages

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

#include <stdio.h>  int main() {       long long lli=1;     printf("%qd/n", lli);     return 0; } 

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

 


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

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: