Print Characters with putchar
Write one character at a time
The check-in board needs a two-letter mark. putchar writes one character at a time; character literals use single quotes. It will not add a newline for you. This example does not call getchar, which reads from stdin.
c
#include <stdio.h>
int main(void) {
putchar('O');
putchar('K');
putchar('\n');
return 0;
}
Run it to see OK on its own line. The three calls append to the same output stream; a function call does not itself start a new line. \n is an escape sequence representing one newline character, even though its spelling uses two characters in your source.
Compare the quotes: 'O' is a character value, while "O" is a string containing a character and its terminator. Use single quotes with putchar. The next exercise asks you to build a different two-letter line.