发布网友
共1个回答
热心网友
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
int p1,p2;
if(p1=fork())
{
printf("I am child 1。\n");
fork();
}
else
{
if(p2=fork()) printf("I am child 2。\n");
else printf("I am parent。\n");
}
return 0;
}