Question: What messages do you see on the screen when you run the following program from / tmp / INF 1 2 1 1 directory? Assume

What messages do you see on the screen when you run the following program from /tmp/INF
1211 directory?
Assume that the user will enter 77 for the first prompt and 55 for the second prompt.
#include
#include
#include
main()
{
pid_t chpid;
int data, status;
printf("Please enter a number:");
scanf("%d", &data);
chpid = fork();
switch(chpid)
{
case 0:
printf("Please enter a number:");
scanf("%d", &data);
printf("Value of data is changed to: %d
", data);
execl("/bin/date", "date", NULL);
break;
default:
wait(&status);
printf("The status is: %d
", WEXITSTATUS(status));
}
printf("The value of data is now: %d
", data);
exit(0);
}

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 Programming Questions!