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
Answers were Sorted based on User's Feedback
Answer / 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 |
What are the Advantages of using macro
what is the use of operator ^ in C ? and how it works?
Print all numbers which has a certain digit in a certain position eg: number=45687 1 number=4 2 number=5 etc
Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)
write a program to generate address labels using structures?
what is C?
program to convert a integer to string in c language'
What is the difference between static and global variables?
write a programe returns the number of times the character appears in the string
What is sizeof array?
How many identifiers are there in c?
How can I change the size of the dynamically allocated array?