Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Parallel Processing ProgramsRSS Feeds

PROGRAM FOR 2^N CHILDREN

Posted By: Vid Fischer     Category: C Programming     Views: 2483

WRITE A PROGRAM FOR 2^N CHILDREN.

Code for PROGRAM FOR 2^N CHILDREN in C Programming

#include<stdio.h>

main()
{
    
    printf("hello process is %d of parent :%d\n",getpid(),getppid());
    fork();
    printf("child : %d of parent %d \n",getpid(),getppid());
    fork();
    printf("child : %d of parent: %d\n",getpid(),getppid());

}
    
OUTPUT
************
[04MCA58@LINTEL 04MCA58]$ cc 2nproc.c
[04mca58@LINTEL 04mca58]$ ./a.out
hello process is 1488 of parent :616
child : 1488 of parent 616
child : 1489 of parent 1488
child : 1489 of parent: 1488
child : 1488 of parent: 616
child : 1491 of parent: 1488
child : 1490 of parent: 1489
  
Share: 


Didn't find what you were looking for? Find more on PROGRAM FOR 2^N CHILDREN Or get search suggestion and latest updates.

Vid Fischer
Vid Fischer author of PROGRAM FOR 2^N CHILDREN is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!