Thread: C program

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0

    C program


    write a C program on Linux to fork() a child process. This
    child process will print the numbers from 1 to 10, and the parent process will print numbers from 11 to 20.

    can anyone help me? please
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,406
    Rep Power
    1871
    Sure, you can start with
    Code:
    int main ( ) {
       print_numbers_in_range(1,10);
       print_numbers_in_range(11,20);
       return 0;
    }
    Convince us you know how to do that within the confines of a single process, then we can talk about fork().
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper

IMN logo majestic logo threadwatch logo seochat tools logo