I can only find references for small c. I assume that the capital C is for Unicode, but I'm not sure. For lower numbers, both output the same character.
+4
A:
From MSDN
%c
When used with printf functions, specifies a single-byte character; when used with wprintf functions, specifies a wide character.
%C
When used with printf functions, specifies a wide character; when used with wprintf functions, specifies a single-byte character.
Ahmed Said
2009-08-02 07:59:26
+4
A:
From MSDN:
%c
type: int or wint_t
When used with printf functions, specifies a single-byte character; when used with wprintf functions, specifies a wide character.
%C
type: int or wint_t
When used with printf functions, specifies a wide character; when used with wprintf functions, specifies a single-byte character.
more about format specifiers here
Indeera
2009-08-02 08:00:41
+3
A:
Note that %C isn't standard. Standard conversion for characters are:
- %c is used for a
int
.printf
output it as it if was anunsigned char
.wprintf
output the result of the convertion to awchar_t
bybtowc
. - %lc is used for a
wint_t
.printf
output the result of the conversion to a multibyte string bywcrtomb
.wprintf
output it as if it was awchar_t
.
AProgrammer
2009-08-02 08:31:49
Which also implies that the Microsoft behaviour for %c in the *w*printf functinos is also non-compliant. From MSDN: "The types C, n, p, and S, and the behavior of c and s with printf functions, are Microsoft extensions and are not ANSI compatible."
Charles Bailey
2009-08-02 08:37:40
The standard defines a behavior for n and p which seems to match the one described in the MSDN link above (which doesn't mention n and p as extension BTW). And I assume that the use of printf instead of wprintf is a typo. Looking at that page, I see another Microsoft extension: the use of h as modifier with c and s which gives them back their standard behavior.
AProgrammer
2009-08-02 08:51:38