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 |
Hai friends im a i year student. i want to develop my knowledge in the field of TSR in c. How I'm Improve ?
What is volatile variable in c with example?
the maximum width of a c variable name can be a) 6 characters b) 8 characters c) 10 characters d) 20 characters
Can 'this' pointer by used in the constructor?
How can I implement sets or arrays of bits?
how to execute a program using if else condition and the output should enter number and the number is odd only...
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.
any "C" function by default returns an a) int value b) float value c) char value d) a & b
what will be the output for the following program? main() { char ch = 'k'; char c; printf("%c",c); }
What is c language used for?
What are pointers? Why are they used?
Write a program in C to convert date displayed in gregorian to julian date