putch() Library Function with Examples

The putch() function is used for printing character to a screen at current cursor location. It is unformatted character output functions. It is defined in header file conio.h.

putch() Syntax


putch(character);
	or
putch(character_variable);

putch() Examples

Example #1 : Displaying Character Using putch()


#include<stdio.h>
#include<conio.h>

void main()
{
  char ch;
  clrscr(); /* Clear the screen */
  printf(“Press any character: ”);
  ch = getch();
  printf(“\nPressed character is:”);
  putch(ch);
  getch(); /* Holding output */
}

Output of the above program :

Press any character:
Pressed character is: e

--------------------------------------------------------
Note: while using getch() pressed character is not echoed. 
Here pressed character is e and it is displayed by putch().