+ 2

What is getchar() function ? Whats its purpose?

27th Mar 2019, 12:01 PM
Rohan Agarwal
Rohan Agarwal - avatar
7 Answers
+ 13
Getchar () takes only 1 character at a time... and if u want to take multiple character u can use gets()
27th Mar 2019, 1:10 PM
Vijay(v-star🌟) - avatar
+ 7
That type of input is used to get a character (one single letter) from the user.
28th Mar 2019, 3:43 PM
Petros the Parakeet
Petros the Parakeet - avatar
+ 3
True DReaMs the main purpose of getchar is not holding the screen. It is just a side effect. The real use of it is to wait until user enters a char to the console and get/return it.
27th Mar 2019, 1:01 PM
Seniru - avatar
+ 2
I think you are c student In simple word getchar () is used to hold the screen
27th Mar 2019, 12:22 PM
a freak
a freak - avatar
+ 2
getchar(), as its name says, helps us to read a single character from the console. For example, char foo = getchar(); putchar(foo); // puts the char on to the console Note: You've to include <cstdio> (in C++) or <stdio.h> (in C) to use this function.
27th Mar 2019, 12:49 PM
777 - avatar
+ 2
Seniru Pasan thanks to you Actually I dont know all stuffs about c. I am new to it.
28th Mar 2019, 8:26 AM
a freak
a freak - avatar
+ 1
It gives you one character as input from user.
3rd Apr 2019, 3:14 AM
Suhani Goyal
Suhani Goyal - avatar