Hi,
check this pice of code
[EMAIL PROTECTED] ~]$ cat test.c
#include <stdio.h>
#define PALINDROME 0
#define NOT_PALINDROME 1
main()
{
char buff[512];
printf("Enter a string: ");
scanf("%s", buff);
if (palindrome(buff) == PALINDROME) {
printf("String is palindrome\n");
}
else {
printf("String is not a palindrome\n");
}
}
int palindrome(char *ptr)
{
int strbeg = 0, strend = 0;
strend = strlen(ptr) - 1;
while ( strbeg == strend || strbeg < strend) {
if (ptr[strbeg] != ptr[strend])
return (NOT_PALINDROME);
strbeg++;
strend--;
}
return (PALINDROME);
}
Thanks & Regards,
Rajath N R
--- On Wed, 10/22/08, elispop122003 <[EMAIL PROTECTED]> wrote:
From: elispop122003 <[EMAIL PROTECTED]>
Subject: [c-prog] Circular Queue
To: [email protected]
Date: Wednesday, October 22, 2008, 11:09 AM
I'm trying to write a program that can read in a string of data and
determine if it is a pack palindrome.
[Non-text portions of this message have been removed]