Answers 865
F
- Buffered input is sent to the program only when the user presses Enter. Unbuffered
input is sent one character at a time, as soon as each key is pressed. - Echoed input automatically sends each character to stdoutas it is received; une-
choed input does not. - You can “unget” only one character between reads. The EOFcharacter can’t be put
back into the input stream with unget(). - With the newline character, which corresponds to the user’s pressing Enter.
- a. Valid
b. Valid
c. Valid
d. Not valid. There is not an identifier of q.
e. Valid
f. Valid
10.stderrcan’t be redirected; it always prints to the screen. stdoutcan be redirected
to somewhere other than the screen.
Exercises
1.printf( “Hello World” );
2.fprintf( stdout, “Hello World” );
puts( “Hello World”);
3.fprintf( stdaux, “Hello Auxiliary Port” );
- The code is as follows:
char buffer[31];
scanf( “%30[^*]”, buffer ); - The code is as follows:
printf( “Jack asked, \”What is a backslash\?\”\nJill said, \
\”It is \’\\’\””); - Hint: Use an array of 26 integers. To count each character, increment the appropri-
ate array element for each character read. - Hint: Get a string at a time, and then print a formatted line number followed by a
tab and the string. Second Hint: Check out the Print_It program in Type & Run 1!
49 448201x-APP F 8/13/02 11:22 AM Page 865