A
Q. What is a standard library function to read 1 char at a time?
- Correct Answer - Option(C)
- Views: 21
- Filed under category C Programming
- Hashtags:
A
In C language, getchar() is a standard library function used to read a single character from the standard input (keyboard).
Usage of getchar()
#include <stdio.h>
int main() {
char ch;
printf("Enter a character: ");
ch = getchar(); // Reads a single character
printf("You entered: %c
", ch);
return 0;
}
Why Not the Other Options?
Thus, (C) getchar() is the correct answer!
You must be Logged in to update hint/solution
Be the first to start discuss.
Discusssion
Login to discuss.