home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / internal / 1976 < prev    next >
Encoding:
Text File  |  1992-11-21  |  967 b   |  46 lines

  1. Newsgroups: comp.unix.internals
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!jvnc.net!news.edu.tw!news!ccsun7.csie.nctu.edu.tw!mchuang
  3. From: mchuang@csie.nctu.edu.tw (Ming-Chuan Huang)
  4. Subject: printf() & fork() ......
  5. Message-ID: <1992Nov19.133035.172@ccsun7.csie.nctu.edu.tw>
  6. Sender: usenet@ccsun7.csie.nctu.edu.tw
  7. Organization: Computer Science & Information Engin., Chiao-Tung U, Taiwan, ROC
  8. X-Newsreader: TIN [version 1.1 PL6]
  9. Date: Thu, 19 Nov 1992 13:30:35 GMT
  10. Lines: 34
  11.  
  12. Hello:
  13.  
  14. #include <stdio.h>
  15.  
  16. program 1:
  17.  
  18. void main()
  19. {
  20.     printf("Hello ");
  21.     if (fork() == 0)
  22.         printf("world\n");
  23. }
  24.  
  25. result:
  26. Hello Hello world
  27.  
  28. program 2:
  29.  
  30. void main()
  31. {
  32.     printf("Hello \n");
  33.     if (fork() == 0)
  34.         printf("world\n");
  35. }
  36.  
  37. result:
  38. Hello 
  39. world
  40.  
  41.  
  42. is there anybody who knows the difference between the two programs ?
  43.  
  44.                                                       mchuang
  45.                                      mchuang@csie.nctu.edu.tw
  46.