In C, the last character in a string must always be the null character "\0".7.Write a C program that reads a line of input from the standard input and then reverse the line. Finally print out the reversed line on the standard output.You may want to use the standard functionstrlento find out the number of characters in a character array. By typing the commandman -s 3 strlen, you will find that you must includestring.hheader file.You may also want to use C's for-loop for this question. The following example shows how to loop through an array:n = strlen(line);for ( i = 0; i < n; ++i ) {c = line[i];}wherenis an integer variable containing the number of characters in the char arrayline,iis an integer variable which acts as the loop index,cis a char variable, andlineis a character array.Lab Assignment:The following work is assessable and is worth 1% of the total unit assessment.1.Explain what thecurrent directoryis and what thehome directoryis. Demonstrate how to set your current directory to a particular directory and how to find out your current directory and how to set your current directory to your home directory.2.Demonstrate that you can create a simple C program (eghello.c) with a text editor from command line (not with a GUI tool) and compile it with gcc and generate executable with appropriate name (eghello).
3.
Complete Exercise 4 in C Programming Exercises.

The deadline of the Lab Assignment is given in the
Teaching Schedule page of this Unit LMS. You must
archive all files related to the Lab Assignment into a
single tar file and upload the archive file to the Unit LMS
on or before the deadline.
Your written answers must include terminal test outputs
if applicable. The terminal output should include the
command line as well as the output from the command.
You may include the terminal output by using cut-and-
paste but please do not modify the terminal output.
Alternatively you can use the command
script
to record
the terminal output.
Final Reminder:
Please remember to copy your work files to your USB
flash drive.
Dr Hong Xie
Unit Coordinator
Created: Tuesday, 1 August 2006
Last update: Monday, 27 July 2015
