Sail E0 Webinar
Question

What will be the output of the following program.
#include<stdio.h>
int main()
{
int pid;
int retvalue;
int p[2];
pipe(p);
char buff[6]="hello";
pid=fork();
if(pid == 0)
{
exit(0);
}
else
{
sleep(1);
retval = write ( p[1], buff);
printf("%d",retval);
}
}



Options:
A .  0
B .  1
C .  -1
D .  6
Answer: Option D



Submit Your Solution Below and Earn Points !
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers