|
|
|
|
|
by sstanie
2985 days ago
|
|
For anyone that clicked through to his 1988 question on comp.lang.c ... what was causing what he was happening? I'm assuming something with an old version of gcc, but I can't reprocue it- I get the correct result using both cc and gcc. https://groups.google.com/forum/#!searchin/comp.lang.c/spols... 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? |
|