Linux下的C编程实战(5)

int main()
{
  int i;
  if (fork() == 0)
  {
    for (i = 1; i < 3; i++)
      printf("This is child process"n");
  }
  else
  {
    for (i = 1; i < 3; i++)
      printf("This is parent process"n");
  }
}

执行结果为:

This is child process

This is child process

This is parent process

This is parent process

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/1886398572ec6070cfe1e70d62001701.html