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 / vignesh1988i

for first printf it will print 0, for second printf it will
print 1.. and finally i will have a value 2.

Is This Answer Correct ?    5 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the basic data types associated with c?

785


what will be maximum number of comparisons when number of elements are given?

1380


Is there any demerits of using pointer?

599


Explain the properties of union.

587


What are the types of pointers in c?

510






What is difference between %d and %i in c?

667


what are the advantages of a macro over a function?

621


What is the use of f in c?

536


Differentiate fundamental data types and derived data types in C.

587


How can I handle floating-point exceptions gracefully?

598


Write programs for String Reversal & Palindrome check

574


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

3105


Why array is used in c?

523


What are global variables and explain how do you declare them?

543


Tell us something about keyword 'auto'.

638