#include #include #include int main() { printf("\nforking!"); pid_t pid = fork(); if (pid < 0) { perror("fork failed"); return 1; } if (pid == 0) { // Child process printf("child processed!"); char *argv[] = {"/bin/pwd", NULL}; char *envp[] = {NULL}; execve("/bin/pwd", argv, envp); // If execve returns, it failed perror("execve failed"); return 1; } else { // Parent process waitpid(pid, NULL, 0); printf("Child process finished\n"); } printf("comp"); return 0; }