COMS 3101-3: Programming Languages (C)

Your program should read a file and print the lines in reverse order to another file, using recursion.

For example, if you have a file with the following contents:

Hello,
        Let us have fun doing the homework!
Bye,
Nalini

Then the output should be as follows:

Nalini
Bye,
        Let us have fun doing the homework!
Hello,

Verify your output by operating a file twice on your program. Check if the resulting file is identical to the original file using the diff command.

diff file1 file3

It prints nothing if the two files are the same.

Happy reversing!


Hint - First try to print the reverse of an array using recursion.