function
<cstdio>
putchar
int putchar ( int character );
Write character to stdout
Writes a character to the standard output (stdout).
It is equivalent to calling putc with stdout as second argument.
Parameters
- character
- The int promotion of the character to be written.
The value is internally converted to an unsigned char when written.
Return Value
On success, the character written is returned.
If a writing error occurs, EOF is returned and the error indicator (ferror) is set.
Example
1 2 3 4 5 6 7 8 9 10
|
/* putchar example: printing the alphabet */
#include <stdio.h>
int main ()
{
char c;
for (c = 'A' ; c <= 'Z' ; c++) putchar (c);
return 0;
}
| |
This program writes ABCDEFGHIJKLMNOPQRSTUVWXYZ to the standard output.
See also
- putc
- Write character to stream (function
)
- fputc
- Write character to stream (function
)
- getchar
- Get character from stdin (function
)