putchar Function

Put a character to stdout.

Include

<stdio.h>

Prototype

int putchar(int c);

Argument

c
character to be written

Return Value

Returns the character or EOF if an error occurs or end-of-file is reached.

Remarks

Same effect as fputc with stdout as an argument.

Example

#include <stdio.h>

int main(void)
{
  char *y;
  char buf[] = "This is text\n";
  int x;

  x = 0;
  for (y = buf; (x != EOF) && (*y != '\0'); y++)
    x = putchar(*y);
} 

Example Output

This is text