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

Explain what are multibyte characters?

833


What is #define size in c?

837


c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

793


What are the 4 types of programming language?

750


How do you use a 'Local Block'?

903






What is a good data structure to use for storing lines of text?

800


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2273


What are 'near' and 'far' pointers?

795


In a switch statement, explain what will happen if a break statement is omitted?

804


What is a rvalue?

933


What is new line escape sequence?

993


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

834


What is structure in c definition?

773


What is define c?

756


Do you know what are the properties of union in c?

764