Computers and Technology

Using the C program shown below, explain what the output will be at lines X and Y.

#include

#include

#include

#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;

}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:30, yoyo9661
Under which key category do the page up and page down keys fall? page up and page down keys fall under the keys category.
Answers: 1
image
Computers and Technology, 23.06.2019 08:00, hernandez09297
What is a scenario where records stored in a computer frequently need to be checked
Answers: 2
image
Computers and Technology, 23.06.2019 09:00, jeremytheprimerapper
Which best compares appointments and events in outlook 2010appointments have a subject man, and events do notappointments have a specific date or range of dates, and events do notappointments have a start and end time of day, and events do notappointments have a location option, and events do not
Answers: 2
image
Computers and Technology, 23.06.2019 09:30, jason9394
Facial expressions and gestures are examples of messages.
Answers: 3
Do you know the correct answer?
Using the C program shown below, explain what the output will be at lines X and Y.

#incl...

Questions in other subjects:

Konu
Mathematics, 24.11.2020 06:00
Konu
Mathematics, 24.11.2020 06:00