#include <stdio.h>
int main(){
printf("当前进程id:%d\n",getpid());
printf("当前进程id:%d\n",getpid());
int t;
if(t = fork()){
printf("我是父进程,我的子进程id为:%d\n",t);
}else{
printf("我是子进程,我的id是:%d\n",getpid());
printf("我是子进程,我的父进程id是:%d\n",getppid());
}
return 0;
}
if(t = fork()){
printf("我是父进程,我的子进程id为:%d\n",t);
}else{
printf("我是子进程,我的id是:%d\n",getpid());
printf("我是子进程,我的父进程id是:%d\n",getppid());
}
return 0;
}