#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#define SIZE 5
int nums[SIZE] = {0,1,2,3,4};
int main()
{
int i;
pid_t pid;
pid = fork();
if (pid == 0) {
for (i = 0; i < SIZE; i++) {
nums[i] *= -i;
printf("CHILD: %d ",nums
[i
]); /* LINE X */ }
}
else if (pid > 0) {
wait(NULL);
for (i = 0; i < SIZE; i++)
printf("PARENT: %d ",nums
[i
]); /* LINE Y */ }
return 0;
}
I2luY2x1ZGUgPHN5cy90eXBlcy5oPgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHVuaXN0ZC5oPgojZGVmaW5lIFNJWkUgNQppbnQgbnVtc1tTSVpFXSA9IHswLDEsMiwzLDR9OwppbnQgbWFpbigpCnsKICAgIGludCBpOwogICAgcGlkX3QgcGlkOwogICAgcGlkID0gZm9yaygpOwogICAgaWYgKHBpZCA9PSAwKSB7CiAgICAgICAgZm9yIChpID0gMDsgaSA8IFNJWkU7IGkrKykgewogICAgICAgICAgICBudW1zW2ldICo9IC1pOwogICAgICAgICAgICBwcmludGYoIkNISUxEOiAlZCAiLG51bXNbaV0pOyAvKiBMSU5FIFggKi8KICAgICAgICB9CiAgICB9CiAgICBlbHNlIGlmIChwaWQgPiAwKSB7CiAgICAgICAgd2FpdChOVUxMKTsKICAgICAgICBmb3IgKGkgPSAwOyBpIDwgU0laRTsgaSsrKQogICAgICAgICAgICBwcmludGYoIlBBUkVOVDogJWQgIixudW1zW2ldKTsgLyogTElORSBZICovCiAgICB9CiAgICBwdXRzKCIiKTsKICAgIHJldHVybiAwOwp9