putchar
raw OCR
Outputs character on stdout.
Defined in header <stdio.h>
Syntax
#include <stdio.h>
int putchar(int c);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ | ■ | ■ |
Remarks
putchar(c) is a macro defined to be putc(c, stdout).
Return value
On success, putchar returns the character c. On error, putchiar returns EOF.
See also
Example
#include <stdio.h>
/* define some box drawing characters */
#define LEFT_TOP 0xDA
#define RIGHT_TOP 0xBF
tdefine HORIZ 0xC4
#define VERT 0xB3
#define LEFT_BOT OxCO
#define RIGHT_BOT 0xD9
int main(void)
char i, j;
/* draw the top of the box */
putchar(LEFT_TOP) ;
for (i=0; i<10; i++)
putchar(HORIZ),•
putchar(RIGHT_TOP);
putchar('\n');
/* draw the middle */
for (i=0; i<4; i++) {
putchar(VERT);
for (]=0; j<10; j++)
putchar (' ');
putchar(VERT);
putchar('\n');
}
/* draw the bottom */
putchar(LEFT_BOT);
for (i=0; i<10; i++)
putchar(HORIZ);
putchar(RIGHT_BOT),•
putchar('\n');
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/stdio.h/putchar/
· short form /3.1/putchar/