jeudi 1 septembre 2016

Why this program wont break out of the loop and ask for input?

I have following code:

badinput:
scanf("%d", choice);
switch (choice){
case 1:
...
case 2:
...
case 3:
...
default: {print("try again");goto badinput;}
}

When I put 1 2 or 3 its ok when i input text, for example "a" program wont stop at next scanf. What is the problem here

Aucun commentaire:

Enregistrer un commentaire