- 2072 Chaitra · 1 mark
Define and write syntax of putchar()
Short answer
putchar(ch) outputs a single character to stdout. The argument can be a char variable, constant, or integer ASCII code. It returns the character written. Example: putchar('A');
Define and write syntax of putchar().
putchar() is an unformatted output function that writes a single character to the screen (standard output). It is declared in <stdio.h>.
Syntax: putchar(character);
The argument is a character constant, a char variable, or an integer ASCII code. It returns the character written.
#include <stdio.h>
int main(void)
{
char ch = 'N';
putchar(ch);
putchar('e');
putchar(65); /* prints A */
putchar('\n');
return 0;
}
Output (65 is the ASCII code of A):
NeA
✓ Answer checked by Claude Opus 5.5 (high effort)