S
Sathyaish
Towards the end of this thread here
http://www.codeguru.com/forum/showthread.php?t=293945
a poster named cma said that if we wanted to ignore the input in the
getchar() function, we could place a call to scanf just before the
getchar in this fashion and the input recieved from the getchar will
be ignored (only the next one character):
int temp;
scanf("%*c");
temp=getchar();
I want some source on the Web or some book to explain this * thing to
me and why it behaves that way. I've read K&R, and another book or two
on C but none so far have discussed this behaviour of scanf. I guess
such things are discovered through experience. I'd be grateful to
someone who could point me to some documentation that discusses this
behaviour.
http://www.codeguru.com/forum/showthread.php?t=293945
a poster named cma said that if we wanted to ignore the input in the
getchar() function, we could place a call to scanf just before the
getchar in this fashion and the input recieved from the getchar will
be ignored (only the next one character):
int temp;
scanf("%*c");
temp=getchar();
I want some source on the Web or some book to explain this * thing to
me and why it behaves that way. I've read K&R, and another book or two
on C but none so far have discussed this behaviour of scanf. I guess
such things are discovered through experience. I'd be grateful to
someone who could point me to some documentation that discusses this
behaviour.