📜  fork 示例问题计数器 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:18.139000             🧑  作者: Mango

代码示例1
int counter = 0;
int main()
{
  int i;
  for (i = 0; i < 2; i ++){
    fork();
    counter++;
    printf("counter = %d\n", counter);
  }
  printf("counter = %d\n", counter);
  return 0;
}