Question: A program's main function is as follows: int main (int argc, char *argv[]) { char *str = argv[1]; while(1) printf(%s, str); return 0; } Two

A program's main function is as follows:

int main (int argc, char *argv[])

{

char *str = argv[1];

while(1)

printf("%s", str);

return 0;

}

Two processes, both running instances of this program are currently running (you can assume nothing else of relevance is). The program were invoked as follows, assuming '&' to be a parallel command and '>' to be the prompt of the shell:

> ./main.a & ./main.b

can "abababab" be part of a possible output? why?

can "bbbbbbb" be part of a possible output? why?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!