Sushil Kumar
Sushil Kumar

Reputation: 75

What %qu format stands for in printf()

What %qu format stands for in printf(). Know that %u is unsigned, %qu never came across. When googled found all other formats apart from %qu

Upvotes: 3

Views: 376

Answers (2)

R.. GitHub STOP HELPING ICE
R.. GitHub STOP HELPING ICE

Reputation: 215407

It's an old BSDism that should not be used, from before C had long long types. From the FreeBSD man page for printf, you can see that, at least on FreeBSD, it was corresponding to the nonstandard type u_quad_t, and that it's marked as deprecated. I'm not sure if u_quad_t was ever formally specified as being unsigned long long, but the portable replacement is using the ll modifier with type unsigned long long, or using the PRIu64 macro with type uint64_t.

Upvotes: 2

paxdiablo
paxdiablo

Reputation: 882068

It's not standard, it's used in some Unixes (mostly BSD) to represent an unsigned quadword (64 bits). Hence the q as a type modifier, like l for long.

Upvotes: 4

Related Questions