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 / srikanth
print order cannot be predicted.Total 8 process(including
main) first process prints 0,1
the first child prints 0,1 and the other 2 child/grand child
process print 1's (two 1s). The other four child/grand child
process wont print anything (created after printf)
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are variables c?
Why do we use stdio h and conio h?
A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers
Is exit(status) truly equivalent to returning the same status from main?
What is difference between && and & in c?
find out largest elemant of diagonalmatrix
What does s c mean in text?
Can stdout be forced to print somewhere other than the screen?
Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.
write a c program to calculate sum of digits till it reduces to a single digit using recursion
which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above
Write a program to print factorial of given number without using recursion?
What is the size of array float a(10)?
How does selection sort work in c?
Explain what is operator promotion?