Files
  • main.c
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int value = 5;

int main(void) 
{
  pid_t pid;

  pid = fork();


  if (pid == 0) {
    wait(NULL);
    value += 15;
    printf("\nCHILD: value = %d", value);
    return 0;
  }

  else if (pid > 0)
  {
    wait(NULL);
    printf("\nPARENT: value = %d", value); /* LINE A */ 
    return 0;
  }
}