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
Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.
Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.
What are the key features in c programming language?
What is the c value paradox and how is it explained?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
Can you please explain the difference between syntax vs logical error?
Why is c called c not d or e?
How do I get an accurate error status return from system on ms-dos?
What is the most efficient way to store flag values?
Explain low-order bytes.
What is the use of c language in real life?
What is a good data structure to use for storing lines of text?
What is the purpose of void pointer?
What is FIFO?