0

I'm requesting an input inside a loop that looks like this:

for (i = 0; i <= 8; i ++)
{
    scanf("%c",&a);
    printf("%c",a);
    printf("This is just for show\n");
}

The output on my console is, while having the user Input "A" followed by an "enter" to set the input:

A
AThis is just for show

This is just for show

Afterwards it´s awaiting a new input, so basically my char variable has once the value of "A" and once of "enter". Can you guys point me on the right track on how can only read in the only first input ("A") and don´t get the "enter" as my second input in the loop?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Rahon
  • 1
  • 2
  • https://stackoverflow.com/questions/14419954/reading-a-single-character-in-c - This should help you. – Rajeev Ranjan Jul 24 '17 at 19:14
  • 1
    This question is asked so frequently I am surprised it does not appear higher in the [**frequent list**](https://stackoverflow.com/questions/tagged/c?sort=frequent) available in the C tag, or the "frequent" tab. – Weather Vane Jul 24 '17 at 19:28

0 Answers0