Output single character in C
When printing a single character in a C program, must I use "%1s" in the format string? Can I use something like "%c"? Evan Teran yes, %c will print a single char: printf("%c", 'h'); also, putchar / putc will work too. From "man putchar": #include <stdio.h> int fputc(int c, FILE *stream); int putc(int c, FILE *stream); int putchar(int c); * fputc() writes the character c, cast to an unsigned char, to stream. * putc() is equivalent to fputc() except that it may be implemented as a macro which evaluates stream more than once. * putchar(c); is equivalent to putc(c,stdout). EDIT: Also note, that