getc() and putc()
Syntax Getc()
variable = getc("characters");
example:
C = getc("C");
C is the variable.
getc() is the input function.
inner C is the character which was used in program
Syntax Putc()
variable = getc("characters");
example:
C = putc("C");
C is the variable.
putc() is the input function.
inner C is the character which was print on print screen.
Example Program
#include<stdio.h>
#include<conio.h>
void main ( )
{
char c ;
clrscr ( );
c = getc ();
putc(c);
printf ( "The input character is %c" , c );
getch ( );
}
Explanation:
- Header file as stdio.h and conio.h
- Main function that was heart of the c program
- Variable declaration, That "char c;" statement used for variable declaration. char keyword indicate the variable is based on character storing.
- Clrscr() function was used to clear previous output on output screen.
- C variable was get the value from getchar() function. getchar() function is predefined. So i get single character from users. More than 1 character its cannot get.
- Putc() functions also predefined function it's display values which variable pass.
- printf() also used to display statement of strings.
- getch() is the functions used to hold the output screen to use.
- end of file
Its simple way of getting values from users by getc() and putc().
Post a Comment