Quick Tip : Scanf waiting for more than expected inputs
Scanf waiting for more than expected inputs:
This problem occurs if you use White spaces such as blanks, tabs, newlines, in the scanf function. like below
1 |
scanf("%d %d n",&a,&b); |
If you observe carefully, There is one space between two
%d format specifiers. So remove all spaces and Try again.
It should work.
From scanf manual page :
1 2 3 4 |
White space (such as blanks, tabs, or newlines) in the format string match any amount of white space, including none, in the input. Everything else matches only itself. |
Related Tutorials :
- Arithmetic Operators with Examples.
- Arithmetic operators priority and it’s Associativity.
- Modulus Operator and Hidden Concepts of Modulus Operator.
- Precedence Table or Operators Priority Table.
- Assignment Operator, Usage, Examples
- Increment Operator and Different types of Increment operators Usage with Examples.
- Decrement Operator and Different types of Decrement operators with Examples.
- Logical or Boolean Operators.