The putchar function can output a character to the terminal. The putchar function is a C library function that writes the characters specified by the char parameter to the standard output. The putchar function declaration: [int putchar(int char)], where the parameter char is the character to be written.
The putchar function can output a character to the terminal. It is one of the C language functions.
(Recommended learning: C language tutorial)
Function introduction:
C library function int putchar(int char) puts the character specified by the parameter char (an unsigned character) is written to standard output stdout.
Function declaration:
int putchar(int char)
char -- This is the character to be written. The character is passed with its corresponding int value.
Return value:
This function returns the written character as an unsigned char cast to int, or EOF if an error occurs.
Code example:
#include <stdio.h> int main () { char ch; for(ch = 'A' ; ch <= 'Z' ; ch++) { putchar(ch); } return(0); }
Result:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
The above is the detailed content of Can the putchar function output a character to the terminal?. For more information, please follow other related articles on the PHP Chinese website!