Top "Getchar" questions

Anything related to C or C++ standard library functions `getchar` (C) or `std::getchar` (C++). These functions are used to read a single character from the standard input stream `stdin`.

Wait for press enter in C inside a while loop?

I'm writing a C program and I need to wait for the user to press any key to continue. When …

c while-loop keypress getchar
String input using getchar()

The following code uses getchar() to accept a line of input. #include <stdio.h> #include <stdlib.h&…

c getchar
GetKeyState() vs. GetAsyncKeyState() vs. getch()?

What's the difference between getting a key press with: GetKeyState() GetAsyncKeyState() getch()? When should I use one over the other?

c++ input keyboard getchar
Putchar and Getchar in C

I'm reading K&R's The C Programming Language and have become confused on putchar and getchar. I made a …

c getchar kernighan-and-ritchie putchar
Printing a string in C using a function

I'm brand new to C and am trying to learn how to take a string and print it using a …

c string char getchar putchar
Clarification needed regarding getchar() and newline

I have a doubt regarding using getchar() to read a character input from the user. char char1, char2; char1 = getchar(); …

c++ c getchar
getchar() returns the same value (27) for up and down arrow keys

So for the up key on the keyboard, I get 27, surprisingly for the down key I also get 27. I need …

c keyboard getchar
getchar does not stop when using scanf

I have a difficulty understanding getchar(). In the following program getchar works as expected: #include <stdio.h> int …

c getchar
(Exercise 1.6 K&R) How to verfiy that getchar() != EOF IS 0 OR 1?

I have just started to learn programming (C) as a hobby, by myself. I'm using K&R. main() { int …

c eof getchar
getting numbers from stdin to an array in C

I'm trying to get numbers from stdin to an array. the first number in stdin is the number of elements …

arrays getchar atoi