#include<stdio.h>
#include <unistd.h>
int main(){
int p1=1,i;
p1 = fork();
if(p1==0){
printf("b\n");
printf("b begin!\n");
for(i=0;i<100;i++) printf("son!\n");
printf("b end!\n");
}else{
printf("a\n");
printf("a begin!\n");
for(i=0;i<100;i++) printf("father!\n");
printf("a end!\n");
int p2 = fork();
if(p2==0){
printf("c\n");
printf("c begin!\n");
for(i=0;i<100;i++) printf("daughter!\n");
printf("c end!\n");
}
}
}
2021-04-24
最新推荐文章于 2022-01-26 22:26:06 发布