#include "forkjoin.h"
#include "shared.h"
main()
{
int a[10],n;
int *flag,fect=1,nproc;
int i,pid,shmid;
char str[20],*d;
printf("Enter the value of the string : ");
scanf("%s",str);
printf("Enter the no. of process : ");
scanf("%d",&nproc);
n=strlen(str);
d=(char *) create_memory(sizeof(char)*n+1,&shmid);
pid=create_process(nproc);
for(i=pid;i<n;i+=nproc)
{
d[n-i-1]=str[i];
}
join_process(nproc,pid);
d[i]='\0';
printf("Reverse string : %s\n",d);
clear_memory(&shmid);
}