GETCHAR()
this is is used to read a single character from the standard input. it waits for the user to enter a character and returns that character as an int. If an end-of-file (EOF) is encountered, it returns EOF. it is commonly used in situations where you want to read one character at a time.
#include <stdio.h>
int main() {
char ch;
// Read a character from the user
printf("Enter a character: ");
ch = getchar(); // Read one character
// Give Input As a
// Output the character using putchar
printf("You entered: ");
putchar(ch); // Output the entered character
return 0;
}
Last updated