I need to get two integers from the user separated by space. The problem is, that if they enter only one integer and press Enter I need to print out the message that they have to enter two values and ask them to do it again.
scanf("%d %d", &a,&b);
This is how I scan for the input. This code is inside a while loop, so basically I keep asking them for 2 valid numbers. It works perfectly, however if I type only 1 int and press Enter key nothing happens until I finally enter the second integer. Making two scanf() is not a good idea because I need values to be separated by a space. Is there any other way to break scanf() if the user presses Enter key? I need to use scanf() only.