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 do I create a directory? How do I remove a directory (and its contents)?
How can I read/write structures from/to data files?
What is the difference between constant pointer and constant variable?
what are # pragma staments?
Is python a c language?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
Explain about the constants which help in debugging?
How can a program be made to print the line number where an error occurs?
When is a “switch” statement preferable over an “if” statement?
Why we not create function inside function.
In which language linux is written?
How do you do dynamic memory allocation in C applications?
Why we write conio h in c?
How do you define a string?
Can the “if” function be used in comparing strings?