+ 2
What is getchar() function ? Whats its purpose?
8 Answers
+ 13
Getchar () takes only 1 character at a time... and if u want to take multiple character u can use gets()
+ 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.
+ 2
I think you are c student
In simple word getchar () is used to hold the screen
+ 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.
+ 2
Seniru Pasan thanks to you
Actually I dont know all stuffs about c.
I am new to it.
+ 1
It gives you one character as input from user.