I'm working on a project and I need to implement a loop that runs and execute a function (foo) until a user enters any input
I already tried some implementations none of them worked (I'm aware that getchar isn't ideal for this operation) for example:
while(1)
{
foo(); //Just a dummy function
if(getchar())//If the user didn't enter an input keep on running
{
break;
}
}
I expect the loop to keep on running and break when the user enters any kind of input.