What is the output of the following program

#include<stdio.h>
main()
{
int i=0;
fork();
printf("%d",i++);
fork();
printf("%d",i++);
fork();
wait();
}

Answer Posted / raghu

totally 8 processes...so each process will print 0 & 1
output: 0101010101010101

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

899


What is call by value in c?

545


Is c weakly typed?

560


State the difference between realloc and free.

617


Where is c used?

641






What is the difference between the local variable and global variable in c?

520


What is sizeof c?

595


Which header file is essential for using strcmp function?

927


What is the difference between far and near ?

674


When can a far pointer be used?

579


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

640


What are near, far and huge pointers?

638


What is the purpose of type declarations?

666


Explain how does free() know explain how much memory to release?

562


#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }

704