multiple getchar()'s in gcc (weird)
Joel Spolsky
spolsky at yale.EDU
Sat Sep 24 00:20:38 AEST 1988
Are you allowed to use getchar() twice? (seems like a silly question?
read on!)
----------------------------------------------------
kangaroo% cat test.c
#include <stdio.h>
main()
{
int c;
c=getchar(); putchar(c);
c=getchar(); putchar(c);
putchar('\n');
}
kangaroo% gcc test.c
kangaroo% echo "Hi" | a.out
H^@
kangaroo% cc test.c
kangaroo% echo "Hi" | a.out
Hi
----------------------------------
Anybody know what's going on?
Joel Spolsky bitnet: spolsky at yalecs uucp: ...!yale!spolsky
Yale University arpa: spolsky at yale.edu voicenet: 203-436-1483
"You can't expect to wield supreme executive power just 'cause
some watery tart threw a sword at you!!"
More information about the Comp.lang.c
mailing list