#include <stdio.h>
#include <string.h>
#include<stdlib.h>
struct node
{
char ch;
struct node * next;
};
int listSize=0;
struct node* stackHead=NULL;
struct node* queueHead=NULL;
struct node* queuetail=NULL;
//----------------------------------
void push(char c)
{
struct node
*new
=(struct node
*)malloc(sizeof(struct node
)); //if(new==NULL){printf("NOT\n");}
new->ch=c;
new->next=stackHead;
stackHead=new;
listSize++;
}
//------------------------------
char pop()
{
struct node* current=stackHead;
char z;
//if(stackHead==NULL){printf("error");}
stackHead=current->next;
z=current->ch;
listSize--;
return z;
}
//------------------------------
void enqueue(char c)
{
struct node* new;
new
=(struct node
*)malloc(sizeof(struct node
));new->next=NULL;
//if(new==NULL){printf("NOT\n");}
new->ch=c;
new->next=NULL;
if((queueHead==NULL)&&(queuetail==NULL))
{
queueHead=new;
queuetail=new;
listSize++;
}
else
{
queuetail->next=new;
queuetail=new;
listSize++;
}
}
//-----------------------------------------------------
char dequeue()
{
if((queueHead
==NULL
)&&(queuetail
==NULL
)){ printf("empty\n"); return 0;}
else
{
struct node* tmp1=queueHead;
queueHead=queueHead->next;
char w;
w=tmp1->ch;
listSize--;
return w;
}
}
//----------------------------------
int isEmpty()
{
int z;
if(stackHead==NULL)
{
z=1;
}
else
{
z=0;
}
return z;
}
//------------------------------------
int main()
{
char stackChar;
char queueChar;
char x;
int i,length;
//int ispalindrome;
int y=1;
for(i=0;i<length;i++)
{
{
if(x !=' '){
push(x);
enqueue(x);
}
}
while (!isEmpty(&stackHead))
{
stackChar=pop();
queueChar=dequeue();
/*if (stackChar==queueChar)
{
ispalindrome= 1;
printf("%c %c\n",stackChar,queueChar);
}
else
{
ispalindrome = 0;
printf("%c %c\n",stackChar,queueChar);
break;
}*/
}
#include <stdio.h>
#include <string.h>
#include<stdlib.h>
struct node
{
char ch;
struct node * next;
};
int listSize=0;
struct node* stackHead=NULL;
struct node* queueHead=NULL;
struct node* queuetail=NULL;
//----------------------------------
void push(char c)
{
struct node
*new
=(struct node
*)malloc(sizeof(struct node
)); //if(new==NULL){printf("NOT\n");}
new->ch=c;
new->next=stackHead;
stackHead=new;
listSize++;
}
//------------------------------
char pop()
{
struct node* current=stackHead;
char z;
//if(stackHead==NULL){printf("error");}
stackHead=current->next;
z=current->ch;
listSize--;
return z;
}
//------------------------------
void enqueue(char c)
{
struct node* new;
new
=(struct node
*)malloc(sizeof(struct node
));new->next=NULL;
//if(new==NULL){printf("NOT\n");}
new->ch=c;
new->next=NULL;
if((queueHead==NULL)&&(queuetail==NULL))
{
queueHead=new;
queuetail=new;
listSize++;
}
else
{
queuetail->next=new;
queuetail=new;
listSize++;
}
}
//-----------------------------------------------------
char dequeue()
{
if((queueHead
==NULL
)&&(queuetail
==NULL
)){ printf("empty\n"); return 0;}
else
{
struct node* tmp1=queueHead;
queueHead=queueHead->next;
char w;
w=tmp1->ch;
listSize--;
return w;
}
}
//----------------------------------
int isEmpty()
{
int z;
if(stackHead==NULL)
{
z=1;
}
else
{
z=0;
}
return z;
}
//------------------------------------
int main()
{
char stackChar;
char queueChar;
char x;
int i,length;
//int ispalindrome;
int y=1;
for(i=0;i<length;i++)
{
{
if(x !=' '){
push(x);
enqueue(x);
}
}
while (!isEmpty(&stackHead))
{
stackChar=pop();
queueChar=dequeue();
/*if (stackChar==queueChar)
{
ispalindrome= 1;
printf("%c %c\n",stackChar,queueChar);
}
else
{
ispalindrome = 0;
printf("%c %c\n",stackChar,queueChar);
break;
}*/
}
struct node* stackHead=NULL;
struct node* queueHead=NULL;
struct node* queuetail=NULL;
//printf("%d\n",ispalindrome);
}
}