logo

Crowdly

Browser

Add to Chrome

Consider the following programs exec1.c #include <unistd.h> #include <stdi...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Consider the following programs

exec1.c

#include <unistd.h>

#include <stdio.h>

int main() {

    execl("./exec2", "./exec2", NULL);   

}

exec2.c

#include <unistd.h>

#include <stdio.h>

int main() {

    execl("/bin/ls", "/bin/ls", NULL);   

   printf("hello\n");

}

Compiled as

cc     exec1.c   -o exec1

cc     exec2.c   -o exec2

And run as

$ ./exec1

Explain the output of the above command (./exec1)

Assume that /bin/ls , i.e. the 'ls' program exists.

0%
0%
0%
0%
0%
More questions like this

Want instant access to all verified answers on moodle.coep.org.in?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome