edited by
950 views
1 votes
1 votes
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
int value = 5;
int main()
{
    pid t pid;
    pid = fork();
    if (pid == 0) { /* child process */
        value += 15;
        return 0;
    }
    else if (pid > 0) { /* parent process */
        wait(NULL);
        printf("PARENT: value = %d",value); /* LINE A */
        return 0;
    }
}

Explain what the output will be at LINE A in this program.

edited by

1 Answer

Related questions

1 votes
1 votes
1 answer
1
akash.dinkar12 asked Mar 19, 2019
444 views
Including the initial parent process, how many processes are created by the following program.#include <stdio.h>#include <unistd.h>int main(){fork(); fork(); ...