Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. The following program (test.c) was compiled and run as shown below. Assuming the current directory is /usr/local, How many times should the sign -
4. The following program (test.c) was compiled and run as shown below. Assuming the current directory is "/usr/local", How many times should the sign "-" be printed when we run the program? Explain your answer. #include #include int main(char* argv[]. int argc) int num = atoi(argv[1]); char *argv2[] = {"test" , "O", NULL }; int i; for (i-t isum; 1++) if (fork) !=0) { execv("/ust/local/test", argv2); forkO fork0: execv(/usr/local/test", argv2); printff-); return 0 The shell commands executed are: gcc-g-o test test.c /test 3 4. The following program (test.c) was compiled and run as shown below. Assuming the current directory is "/usr/local", How many times should the sign "-" be printed when we run the program? Explain your answer. #include #include int main(char* argv[]. int argc) int num = atoi(argv[1]); char *argv2[] = {"test" , "O", NULL }; int i; for (i-t isum; 1++) if (fork) !=0) { execv("/ust/local/test", argv2); forkO fork0: execv(/usr/local/test", argv2); printff-); return 0 The shell commands executed are: gcc-g-o test test.c /test 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started