#: 20869 S3/Languages
26-Mar-95 22:10:38
Sb: #20865-#scanf() question
Fm: Bob van der Poel 76510,2203
To: David Breeding 72330,2051 (X)
I must admit that not only do I not advocate using scanf()...I've never used it
either. So, I decided to test a bit...interesting.
main()
{
int v1, v2;
scanf("%d%d", &v1, &v2);
printf("V1=%d V2=%d\n", v1, v2);
}
With this program I can enter either:
123 456
or
123
456
and get proper results. Matter of fact, I can even put in extra spaces and all
is okay. I figured that I would have to include a \n in the control string to
such the CR input from the keyboard...but that really doesn't work at all.
Hmmm, maybe I know why I don't use this now.
There are 2 Replies.
|