Consider the following C program.
#include <stdio.h>
int main() {
int i;
for (i=0;i<3;++i) {
fork();fork();
}
}
How many processes are created when running this program
(including the initial one)?
Explain
Answer Posted / chetan raikwar
According to me, Total 6 processes.
1- execution of main() along with included library<stdio.h>.
2- declaration of 'i' as type 'int'.
3- for (i=0;i<3;++i)
4- fork();
5- fork(); (since two separate function will be executed separately whether it's a loop or not.
5- Termination of main function. }
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How can I direct output to the printer?
explain what are actual arguments?
What is storage class?
How does #define work?
how to write optimum code to divide a 50 digit number with a 25 digit number??
Why do we use int main instead of void main in c?
What is zero based addressing?
What is unary operator?
What is the difference between NULL and NUL?
How many levels of indirection in pointers can you have in a single declaration?
What does the characters “r” and “w” mean when writing programs that will make use of files?
Did c have any year 2000 problems?
What are header files? What are their uses?
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?
Difference between Shallow copy and Deep copy?