You never initialized the value of x. When is the loop supposed to stop? Stopping at the null character '\0' might be a good idea... Also, you can't have both the loop and and function keeping track of top. You can use a while loop to go through the string and push will modify top for you.
I didn't read all your code but from the general idea of the code i assume that you want to know how to use the stack to check if the word is palindrome or not.
- After you enter the string you will push all of its element from the first character till the end of the string (Using a Pointer ofcourse till the Pointer Reaches NULL).
-Then Pop all the elements from the stack and recieve them in another string.
-And compare the newly created string to the original string that been entered at the first of your program.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.