how to use push and pop here???
thanks!
#include<stdio.h>
#include<stdlib.h>
void push(char palindrome[20], int *top, int value)
{
if(*top<=10)
{
palindrome[*top]=value;
*top++;
}
else
{
printf("Stack is full!!");
exit(0);
}
}
int value;
void pop(char palindrome[10], int *top)
{
if(*top>=0)
{
value=palindrome[*top];
*top=*top-1;
}
else
{
printf("The stack is empty!!\n");
}
}
char palindrome[10];
int top = -1;
int value;
int x;
void main()
{
clrscr();
printf("Enter word: ");
scanf("%s",&value);
for(top=0;palindrome[top]!=x;top++)
{
}
top--;
for(value=0;palindrome[value]!=x;value++,top--)
{
if(palindrome[top]!=palindrome[value])
x=1;
}
if(x==0)
{
printf("The word you've entered is a palindrome!!\n");
}
else
{
printf("The word you've entered is not a palindrome!!\n");
}
getch();
}