scanf(..)

burkie at uxe.cso.uiuc.edu burkie at uxe.cso.uiuc.edu
Sat Jun 3 08:20:00 AEST 1989




char	c;
...

scanf("%c", &c);
...

I find that sometimes the program above doesn't stop
at the scanf to wait for input, esp. if there are other
input, print etc. statements.. Do I have to flush some 
buffers etc for this to work properly?

In response to

int	x, y;

while (...) {
	scanf("%d, %d", &x, &y);
}

if I type 'a' on the keyboard, why
does the loop keep running, skipping over the scanf ?

Thanks.

-Salman
burkie at uxe.cso.uiuc.edu



More information about the Comp.lang.c mailing list