$24
1. Execute and familiarize with Linux environment and commands
• Getting used to basic commands on Linux Operating System – Process creation, Process monitoring, Process states, Linux File system tree, Linux File system commands
2. Write a C program to display an array in reverse using index.
Create Makefile (ex: make.mk below) and other files as shown below: (Hint: Refer to Makefile tutorial sent before to create these files)
Client.c – contains main function to collect input on array elements from the user and calls reverse_array function
Server.c – contains reverse_array function and prints the reversed array (use a separate function to print the reversed array)
Header.h – contains function prototypes
make.mk – contains targets and their dependencies
Program Execution and Expected Output
$make -f make.mk
$./a.out
ENTER SIZE OF AN ARRAY
4
ENTER ELEMENTS OF AN ARRAY
1
2
3
4
Input array is
1234
Reversed array is
4321
Submission
1. Basic LINUX commands (ANY 5) executed in the lab should be submitted in the following way:
Command: What does the command do?
Any two options (i.e flags or arguments) regarding the command
Outcome of the command
2. Main program and all sub programs (dependency files, header file and Makefile) should be submitted. Steps to execute make and output of the program should be submitted.
3. Answer the following questions (Brief answers only)
• Why do we use Makefile?
• Is Makefile a shell script?
• What does “clean” do in Makefile?
• How does make learn about the last modified files to be complied?
• What does Cflags in Makefile mean?
• Why do we use -f option with make command?