Question: Question 2 How does the following code work? Do not just describe the syntax. 1 #include 2 #include 3 #include Cunistd.h> 4 5 int main()

 Question 2 How does the following code work? Do not just

Question 2 How does the following code work? Do not just describe the syntax. 1 #include 2 #include 3 #include Cunistd.h> 4 5 int main() { 6 pid_t pid; 7 8 pid = forko: 9 if (pid == 0) { 10 fprintf(stderr, "Fork failed"); 11 return 1; 12 } 13 else if (pid > 0) { 14 execlp("/bin'ls", "IS". NULL); 15 16 else { 17 wait(NULL); 18 } 19 return 0; 20 }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!