hi all,
can u guys help me out .........
how do i find if a gn string is palindrome or not using pointers in C??
regards
vidya
take two pointers, one pointing to the beginning of the string and another to the end of the string.
ptr1=string;
ptr2=ptr1 + string.length();
while (ptr1 < ptr2)
{
compare *ptr1 and *ptr2, break if not equal and string is not palindrome
if equal
increment ptr1 by 1
and decrement ptr2 by 1
}
check if(ptr1< ptr2)
it means string is not palindrome
otherwise string is palindrome