Standard Library Functions in C

adplus-dvertising
getchar() Function
Previous Home Next

Description

The C library function, The

getchar()

function is used to enter a single character into the computer. The getchar function is a part of the standard c input/output library.

Declaration

Following is the declaration for getchar() function.

int getchar(void)

Parameters

None

Return Value

The getchar( ) function returns the next character from stdin. The character is read as an unsigned char that is converted to an integer.

Example

#include<stdio.h>
int main()
{
   char ch;
   ch = getchar();
   printf("Accepted Character : %c",ch);
}

Output

Accepted Character : A
Previous Home Next