Here is the code that causes the problem:
int n;
do{
printf(/*Message that tells the user to enter an int*/);
}while(scanf("%d", &n) != 1);//Checks that the variable is an int; if not restarts the do while loop and waits for the user input again (at least it's what it's supposed to do)
when the user enters an int, the code continues normally. But if they enter something else, this is repeated infinitely:
printf(/*Message that tells the user to enter an int*/);
without waiting for the user input again. I don't know what to do now, this problem is driving me crazy (i'm a newbie, so if the question ends up being stupid, i won't be surprised), any help would be welcome! thank you in advance!