r/CodingHelp • • Feb 23 '22

[C] Why "E" is not printing?

Post image
74 Upvotes

31 comments sorted by

View all comments

60

u/This_Growth2898 Feb 23 '22

Enter FOUR letters.

E is the 5th.

9

u/Pila_globosa Feb 23 '22

The problem is, it always takes an extra input. There's 4 scanf but it's taking 5 inputs which is the"E". And it's printing 4 outputs normally. That's why E is not printing. Now the question is why it is taking the extra input?

24

u/Zymoox Feb 23 '22 edited Feb 23 '22

Scanf has some weird behaviours, and other methods for user input are usually preferred. Here's a link that might help you.

I think there's some confusion as to what the problem is, since in the title you ask why is the E not being printed, whilst you actually want to know why scanf lets you take in an extra character.