What's putchar () for?
Editor to share with you what is the use of putchar (), I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
The function of putchar () is to output a character to the terminal; the syntax structure of putchar is "int putchar (int char)", which means that the characters specified by the parameter char are written into the standard output stdout; putchar is a C library function, which is included in the C standard library.
The syntax structure of putchar () is int putchar (int char). Its function is to write the character specified by the parameter char (an unsigned character) into the standard output stdout. It is a C library function and is included in the C standard library.
The output can be a character, a decimal integer between 0,127 (inclusive), or a character variable defined with char.
Putchar syntax
(1) function declaration
Int putchar (int char)
(2) parameters
Char-- this is the character to be written. The character is passed with its corresponding int value.
(3) function
Writes the character specified by the parameter char (an unsigned character) to the standard output stdout. [3]
(4) description
This function outputs the characters corresponding to the value of the specified expression to the standard output terminal. The expression can be character or integer, and it can only output one character at a time. For example: "putchar ('#')" outputs the character "#".
Return value
This function returns the written character as an unsigned char cast to int, or EOF if an error occurs.
Example
The following example demonstrates the use of the putchar () function.
# include int main () {char ch; for (ch ='A'; ch)