problems with scanf
Posted
by lego69
on Stack Overflow
See other posts from Stack Overflow
or by lego69
Published on 2010-05-15T18:46:58Z
Indexed on
2010/05/15
18:54 UTC
Read the original article
Hit count: 263
c
hello, I've got some problems with this snippet of the code
while(scanf("%d",&numOfPlayers)!=1){
printf("Please enter the right number of players");
}
my purpose is to take the number from the user but if number is not int, I must ask him one more time, when I check this snippet and print 'r' for example I receive eternal loop, what may be the problem, how can I improve it? thanks in advance
© Stack Overflow or respective owner