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 is the purpose of & in scanf?
main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }
5 Answers Vector, Vector Solutions,
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
Explain what is the stack?
please explain every phase in the "SDLC" in the dotnet.
Explain what is the benefit of using #define to declare a constant?
What are volatile variables?
what is diffrence between string and character array?
What is ponter?
What is difference between structure and union in c?
Is linux written in c?