s64421@zeus.usq.EDU.AU (house ron) (03/11/91)
A friend has found that the following program behaves oddly under
Quick C:
main()
{
int i,j;char c;
i = scanf("%d%c",&j,&c);
printf("%d %d %c\n",i,j,c);
}
The idea is to have the newline typed after the number put into c.
However, Quick C version 2.5 requires that the user type TWO newlines
before any output is produced. Earlier versions, and other C compilers
I have tried (Power C, TopSpeed C) produce their output after the
expected one newline. I know the behaviour of Quick C V2.5 is wierd,
but is it actually ILLEGAL, according to the ANSI C standard? It is
a question of timing, and most language standards are very lax about
that issue.
--
Regards,
Ron House. (s64421@zeus.usq.edu.au)
(By post: Info Tech, U.C.S.Q. Toowoomba. Australia. 4350)