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
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?
When should volatile modifier be used?
if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above
Why isnt any of this standardized in c?
write a program to find out prime number using sieve case?
Explain what standard functions are available to manipulate strings?
Where are c variables stored in memory?
what is the structure pointer?
What is indirection in c?
The __________ attribute is used to announce variables based on definitions of columns in a table?
What are the 32 keywords in c?
What is the difference between near, far and huge pointers?
What is the difference between %d and %i?
What is table lookup in c?
How important is structure in life?