I have the following C code.
我有以下C代码。
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main ()
{
int i=1;
pid_t child_pid = fork();
if (child_pid == 0)
{
printf ("%d\n", i++);
printf ("%d\n", i++);
printf ("This is child process.");
return 0;
}
else if (child_pid > 0) {
printf ("%d\n", i++);
printf ("This is parent process.");
}
else {
printf("Fork failed");
}
}
#incl