What is the exact output of the following code include inclu
What is the exact output of the following code?
#include <stdio.h>
#include <unistd.h>
main()
{
int i,j;
i=fork();
for (j=0; j<3; j++)
{
if (i == 0 && j == 0)
{
sleep(3);
printf(\"Cats\ \");
}
else if (i == 0)
{
sleep(2);
printf(\"Dogs\ \");
}
else
{
sleep(2);
printf(\"Raining\ \");
}
}
}
Solution
Answer for the above code is as follows:
Status : runtime error
Output:
Raining
Raining
Raining

