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

Seems you need to start several processes with different sorting methods.
If you need to compare times you can write separate programs and use
'time' for measuring their speed.

But if you really need do start several functions in separate processes
the you can use fork() inside loop. Parent will continue loop while child
should break it. Read fork() manual.

Regards