Do you think getc(stdin) is equivalent to the use of getchar() ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

Do you think getc(stdin) is equivalent to the use of getchar() ?

question of File Handling in C. use of unformatted input and output

1st Jul 2018, 6:23 PM
Anwesha Kar
Anwesha Kar - avatar
2 Answers
+ 6
getc() can read from any input stream(no matter if it is file stream or standard input stream). But this is not true in case of getchar(). Although both are used to read a single character, getchar() is used when we want to read a character from standard input stream(because it can only read from standard input stream and not any other stream). getchar() is equivalent to getc(stdin).
1st Jul 2018, 6:46 PM
Vaibhav Sankhla
Vaibhav Sankhla - avatar
+ 1
hello
7th Aug 2018, 5:56 PM
Oyatullo Sangov
Oyatullo Sangov - avatar