Stack use

Hi,

My code needs to get string from user and check if it is consisting of its reverse. Do I need to use stack? if yes why? I mean why we need to use stack to check 1D array if its first n letters are reverse of last n letters?
like array is: abcddcba
How can I use stack to check if abcd is reverse of dcba?
Can someone let me understand what stuck really need to do here?
I already wrote some code but need some explanation to finalize it...

Thanks in advance
Anyone who can check the code to tell me where is my mistake?
add every letter in a stack than check every letter again with the letter on top of the stack and pop the stack, if every letter matches than that word is a reverse

so for the word abcba the stack would be
a(last a)
b(last b)
c
b(first b)
a(first a)

and if you get the letters from top o bottom the word is the same so its a reverse

where is the code?
are you talking about palindrome strings???
Topic archived. No new replies allowed.