C++ getchar() Function Last Updated : 27 Nov, 2022 Comments Improve Suggest changes Like Article Like Report getchar( ) is a function that takes a single input character from standard input. The major difference between getchar( ) and getc( ) is that getc( ) can take input from any number of input streams but getchar( ) can take input from a single standard input stream. It is present inside the stdin.h C library. Just like getchar, there is also a function called putchar( ) that prints only one character to the standard output screen Syntax: int getchar(void); Return Type: The input from the standard input is read as an unsigned char and then it is typecasted and returned as an integer value(int) or EOF(End Of File). A EOF is returned in two cases, 1. when file end is reached. 2. When there is an error during execution. Example: C++ // C++ Program to implement // Use of getchar() #include <cstdio> #include <iostream> using namespace std; int main() { char x; x = getchar(); cout << "The entered character is : " << x; return 0; } Output: Output Example : C++ // C++ Program to implement // Use of getchar() and putchar() #include <cstdio> #include <iostream> using namespace std; int main() { char x; x = getchar(); cout << "The entered character is : "; putchar(x); return 0; } Output: Output Comment More infoAdvertise with us Next Article C String Functions S sayanc170 Follow Improve Article Tags : Technical Scripter C++ Technical Scripter 2022 CPP-Library Practice Tags : CPP Similar Reads getchar Function in C C getchar is a standard library function that takes a single input character from standard input. The major difference between getchar and getc is that getc can take input from any no of input streams but getchar can take input from a single standard input stream. It is defined inside the <stdio. 3 min read getchar Function in C C getchar is a standard library function that takes a single input character from standard input. The major difference between getchar and getc is that getc can take input from any no of input streams but getchar can take input from a single standard input stream. It is defined inside the <stdio. 3 min read C String Functions C language provides various built-in functions that can be used for various operations and manipulations on strings. These string functions make it easier to perform tasks such as string copy, concatenation, comparison, length, etc. The <string.h> header file contains these string functions.Th 6 min read C String Functions C language provides various built-in functions that can be used for various operations and manipulations on strings. These string functions make it easier to perform tasks such as string copy, concatenation, comparison, length, etc. The <string.h> header file contains these string functions.Th 6 min read C++ printf() Function printf() function is originally declared under the <cstdio>header file. It prints the formatted string to the standard output stdout. Syntax: int printf(const char*word, .......) Parameters: word: represents the string that needs to be printed on the standard output stdout,....... : represents 3 min read wcsrchr() function in C/C++ The wcsrchr() function is a builtin function in C/C++ which searches for the last occurrence of a wide character in a wide string. It is defined within the cwchar header file in C++. Syntax: wcsrchr(str, ch) Parameters: The function accepts two parameters which are described below. str: It specifies 2 min read Like