The goal behind the following is asking the user for input until an exit string is entered but the preferred execution is not met because this function spams the printf strings and does not take user input more than one time
void test()
{
    int res=0;
    while (res >=0)
    {
        char buffer[1024];
        printf("Enter input: ");
        res = scanf("%[^\n]", buffer);
        printf("\n[%d]you entered: %s\n",res , buffer);
        if (strcmp(buffer, "exit") == 0)
            return ;
    }
}
int main()
{
    test();
    return 0;
}
How to use scanf so that it waits until a user inputs something?
