Don’t Make This Common Scanf Mistake!

So there’s this common ‘scanf’ or ‘getchar’ mistake that a lot of beginners make when first starting to learn how to code in C. These two C functions are common functions that beginners learn to handle basic user input for their programs. These mistakes are pretty understandable. Even I myself have made this mistake in the past, and I think it’s even possible for senior developers to make this mistake too.

I got some emails recently from a new C programmer, named Syed, asking me questions about the issues with his use of ‘scanf’ and ‘getchar’. He encountered this issue while he was going through my 30 Day Beginner Coding Challenge (Download it here for free if you haven’t gotten it yet).

The first program in that guide is a tip calculator program and he was having issues with the second time the program would run. This is a common mistake that I see people make when first starting to use ‘scanf’ and ‘getchar’ so I thought it would be helpful if I did a video about it going into it with a little more depth.

In this video, you’ll learn:
✅ how to debug code effectively
✅ another use case for why I like C
✅ how to use scanf with characters properly

Thank you for watching, and happy coding! 💻🧡
-Henrik