1:  /*
   2:  Author:Justinzhang
   3:  email:uestczhangchao@gmail.com
   4:  time:2012-8-30 22:17:23
   5:  desc:fork problem, from www.qshpan.com
   6:  */
   7:   
   8:  #include <stdio.h>
   9:  #include <stdlib.h>
  10:  int sum;
  11:  int main()
  12:  {
  13:      int i = 0;
  14:      sum = 0;
  15:      fork();
  16:      for(i=0; i<5; i++)
  17:      {
  18:          printf("%d\n",i);
  19:          fflush(stdout);
  20:          sum += i;
  21:      }
  22:      printf("sum = %d\n", sum);
  23:      
  24:      exit(0);
  25:  }

相关文章:

  • 2022-12-23
  • 2021-11-03
  • 2022-03-05
  • 2021-10-11
  • 2021-11-19
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-07
  • 2021-10-16
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2021-08-11
相关资源
相似解决方案