Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

% ./hw3_ex1 Enter a 5-character string: hguot String #1: tough String #2: HGUOT

ID: 3552331 • Letter: #

Question

% ./hw3_ex1
Enter a 5-character string: hguot
String #1: tough
String #2: HGUOT

You may
assume that the user will always type exactly 5 characters followed by a
carriage return (no need to deal with errors, etc.).

Reading a character from the
keyboard is done via the
read_char macro (see page 17 of the textbook for a description).
So you'll have to call this macro 5 times to get the 5 characters.

Remember that when you print a
string it should be null-terminated. So, to store a 5-character string that you
will print you need to store it in 6 bytes, with the last byte equal to 0.

Explanation / Answer

http://pastebin.com/gw2tYkz9