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
What are the different types of data structures in c?
Write a program for Overriding.
What is sizeof int in c?
Can we change the value of static variable in c?
What is the heap?
What is the advantage of using #define to declare a constant?
What are the functions to open and close file in c language?
What is the usage of the pointer in c?
What is the difference between struct and union in C?
Between macros and functions,which is better to use and why?
Do you know the use of 'auto' keyword?
What is a lvalue
I have a varargs function which accepts a float parameter?
What is an array in c?
What is the advantage of c?