#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

  

相关文章:

  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
  • 2021-12-10
  • 2021-10-13
  • 2021-08-05
  • 2021-08-26
  • 2022-12-23
猜你喜欢
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
  • 2021-12-23
  • 2021-04-06
  • 2022-12-23
相关资源
相似解决方案