Homework 12: Pointers and Separate Compilation Homework
Wednesday, April 25, 2012[Up] [Previous Homework] [Next Homework]
Complete the following:
- NOTE: You need to start indenting your programs properly. Points will be taken off for not indenting this homework appropriately
- Reminder to look at CMSC104 Indentation Standards
- You will create two .c files for this homework, BOTH must be submitted
- You are going to implement a program to reverse strings the user types in
- One file, reverse.c, will implement a function with the following function definition:
void reverse(char *in_str, char *out_str);
- The second file, hw12.c, will implement main()
- Main should define two arrays of characters, one to store user input, and one to store the reversed string, each 30 characters long
- Main should then ask the user to input a string
- Main should pass the user input string as the first argument to the reverse() function
- Main should pass the second string as the second argument to reverse() as the output memory for the reversed string
- After calling reverse, main should print out the reversed string, followed by the original string
- An example output is below
linux2[1]% ./hw12 Input string: hey_this_is_a_test Reversed string: tset_a_si_siht_yeh Original string: hey_this_is_a_test
- Create a script of you running your program three times.
- Once you are done, use submit to submit three files, hw12.c reverse.c and typescript
linux3[1]% submit cs104_sheets hw12 hw12.c reverse.c typescript