Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A simple question [but I dont know how to answer =.=]

    In class, xxx changed a program which had

    printf(“Before\n”); fork(); printf(“After\n”); to

    printf(“Before”); fork(); printf(“After\n”);

    In the first case, the code printed out
    Before
    After
    After


    In the second case it printed
    BeforeAfter
    BeforeAfter

    Explain in your own words (and diagrams if needed) what is happening.
    Can anybody help me?

  • #2
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    See the sticky about homework assignments.

  • #3
    Gox
    Gox is offline
    Regular Coder Gox's Avatar
    Join Date
    May 2006
    Location
    Ontario, Canada
    Posts
    392
    Thanks
    2
    Thanked 20 Times in 20 Posts
    Furthermore, you may want to read about fork(). http://www.csl.mtu.edu/cs4411/www/NO...rk/create.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •