Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
1st Parameter
The character to be written, represented as an `int`. The value is internally converted to `unsigned char`.
Read more about parameters of putchar in parameters section
The putcharfunction in C language Writes a character to the standard output stream.
The putchar function writes a single character to stdout, the standard output stream. It is equivalent to putc(c, stdout). This function is commonly used for character-by-character output to the console. It's often implemented as a macro for efficiency.
The putcharfunction takes 1
parameter:
•
int `character`: The character to be written, represented as an `int`. The value is internally converted to `unsigned char`.
Writes the character specified by `character` to the standard output stream (`stdout`). Returns the character written as an `unsigned char` cast to `int`, or `EOF` if an error occurs. Typically used for character-by-character output to the console.
The putchar function return value :
Returns the character written as an unsigned char cast to an int if successful, or EOF if an error occurred
Output
This example demonstrates how to use putchar to write a string character by character to the standard output. It also includes error checking.