📅  最后修改于: 2022-03-11 14:50:40.887000             🧑  作者: Mango
#include
#include
int main()
{
int id = fork();
if (id < 0)
printf("Fork failure\n");
else if (id == 0)
printf("Inside child: Pid of Parent Process: %d ::Pid of Child Process: %d\n\n", getppid(), getpid());
else
printf("Inside Parent: Pid of Parent Process: %d ::Pid of Child Process: %d\n\n", getpid(), id);
return 0;
}