program in c for to check whether the string is pallendrom or not using stack.h file and stack
Pallendrom string
Collapse
X
-
If the palindrome was one word (a string of characters) you could make one pointer point to the first letter and a second pointer point to the last letter and compare *p1 with *p2 from within the body of a for loop. If they are == increment p1(++) and decrement p2(--) and continue to compare for equality until the loop condition (< length of the word/2)is reached or the comparison fails. The same principle could be applied to a sentence.Comment
-
This will work, but won't be accepted because it doesn't use (! turbo-c header) stack.h . The solution that may pass is to push the entire string into the stack and then pop it back comparing to it again, so that the first character in the string is compared to the last pushed ( = first popped ) into the stack.Comment
Comment