Write a program that displays all environment variables


Problem

1. Write a program that displays all environment variables.

2. Write a program that sets an int variable x to 100 before forking a child. Next perform the following in the child and parent: Child:

(i) Display the value of x, reset it to 200, and display it again.

(ii) Display the value of PATH, reset it to only ., and display it again.

(iii) Change the current directory to /etc and display the absolute pathname of the changed directory.

Parent:

(i) Sleep for 2 seconds.

(ii) Display the value of x, PATH, and the pathname of the current directory.

Explain your observations. Why was the parent made to sleep for two seconds?

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a program that displays all environment variables
Reference No:- TGS02672093

Expected delivery within 24 Hours