Linux c 开发-12 创建子进程

#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
int main()
{
    pid_t fpid;
    fpid=fork();
    if(fpid==0){printf("I am child\n");}
    else {printf("I am father\n");}    
}

输出结果:

I am father
I am child

  

posted @ 2021-03-28 22:29  zhaogaojian  阅读(84)  评论(0编辑  收藏  举报