Why does C's printf format string have both %c and %s?

c, string-formatting

Solution

Probably to distinguish between null terminated string and a character. If they just had `%s`, then every single character must also be null terminated.

char c = 'a';

In the above case, `c` must be null terminated. This is my assumption though :)

Problem

Why does C's printf format string have both `%c` and `%s`? I know that `%c` represents a single character and `%s` represents a null-terminated string of characters, but wouldn't the string representation alone be enough?

Original source

Related problems