Logo 
Search:

C Programming Articles

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

PROGRAM TO CHECK THE STRING IS PALINDROM OR NOT, PARALLELY

Posted By: Hedwig Miller     Category: C Programming     Views: 2899

PROGRAM TO CHECK THE STRING IS PALINDROM OR NOT, PARALLELY

Code for PROGRAM TO CHECK THE STRING IS PALINDROM OR NOT, PARALLELY in C Programming

#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);
    if(strcmp(str,d)==0)
        printf("Given string is palindrom\n");
    else
        printf("Given string is not palindorm\n");
    clear_memory(&shmid);
}
  
Share: 


Didn't find what you were looking for? Find more on PROGRAM TO CHECK THE STRING IS PALINDROM OR NOT, PARALLELY Or get search suggestion and latest updates.

Hedwig Miller
Hedwig Miller author of PROGRAM TO CHECK THE STRING IS PALINDROM OR NOT, PARALLELY is from Frankfurt, Germany.
 
View All Articles

 
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!