Image

C Language - Structure of C - Input Output Operation

Input Output Operation

C support two types of input and ouput statement.

  • unformated
  • formated

unformated

Reading and writing a character in unformatted way. There are two types of function are used in unformatted way

  • getchar()
  • putchar()
getchar()

1.getchar() It is used to read single character from standard device that is keyboard . it is define within #include<stdio.h>

Syntax: variable_name = getchar();
EX: char c;
c = getchar();


putchar()

putchar() It is used to print single character on standard output device that is monitor. It is define within #include<stdio.h>

Syntax: putchar(variable_name);
EX: putchar(c);


Example getchar() & putchar()
#include<stdio.h>
#include<conio.h>
main(){
char c;
clrscr();
printf("\nEnter any character ");
c=getchar();
printf("\nEnter Character ");
putchar(c);
getch();
}