so running the following code
Code:
#include <stdio.h>
int main(void) {
char c;
int i=1;
while (scanf("%c", &c)==1)
printf("loop sequence %i: %c(%i)\n", i++, c, (int)c);
printf("\ndone\n");
return 0;
}
would produce something like this
Code:
1
loop sequence 1: 1(49)
loop sequence 2:
(10)
2
loop sequence 3: 2(50)
loop sequence 4:
(10)
a
loop sequence 5: a(97)
loop sequence 6:
(10)
b
loop sequence 7: b(98)
loop sequence 8:
(10)
done
it seems a "carriage return" serves two purposes here, one is to signal the program to read in the character typed in before the "carriage return", another serves as a second character typed, how can i do this cleanly, that is without having to use a "carriage return" as the second character to signal "i've typed in the first character already"