When printing an int to stdout, the %d type is used. Why "d"? The other types (s for string, c for char, f for float) all make mnemonic sense, but I cannot figure out why "d" for int. It's not short for "double" or "decimal" I think.

Recommended Answers

All 3 Replies

Thanks, Salem. In languages such as C# there exists a separate decimal type, and int is not a decimal. That's why I thought that something similar might be in C.

Have a great week!

%i = integer, but its the same as %d
%u = unsigned integer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.