how can i make sure that the user inputs the right amount of numbers.
what i mean is:
the input needs to be 2 int numbres with space between them. for example:
and i want to make sure that if the user input only one number and press return,
it will print "ERROR" and the program return 1.
thank you for your help
There are many ways. One way is reading the entire line of input to a string and then checking the content of that string to determine if it can be interpreted as two ints with an intervening space.
if( scanf( "%d %d", &n1, &n2 ) == 2 )