03-02-2005
2,
0
Join Date: Mar 2005
Last Activity: 4 March 2005, 9:34 AM EST
Posts: 2
Thanks Given: 0
Thanked 0 Times in 0 Posts
implementation of all sorting algorithms using fork
im new to programming c in unix
this is program written by me i want each and every child to do a seperate work such implement a different sorting algorithm but im not getting the way i wrote as below...plz help me how can i do that
#include<stdio.h>
main()
{
int i;
for(i=0;i<5;i++)
{
fork();
child(i);
exit(0);
}
}
child(int j)
{
switch(j)
{
case 0: printf("iam child1 %d\n",j);
break;
case 1: printf("iam child 2 %d\n",j);
break;
default: printf("iam other\n");
}
return;
}
i want child 1 to execute case 1 child 2 to execute case 2....but all childs are executing only case 0
thank u
Last edited by chaitu07; 03-03-2005 at 02:18 PM..
Reason: i have implemented as u said but im not getting