CSE 142 Quiz 7
August 3rd, 2000

Name:
SID:

Write the following function:

Write a function isPalindrome which takes a string and returns 1 if the string is a palindrome, 0 if it is not. For example: amanaplanacanalpanama is a palindrome, whereas palindrome isn't. You may use any of the functions in string.h, and can assume all strings are null terminated and fit in an array of size SIZE. Lastly, you may assume you have the following function:

void reverse(char s[]);
/* takes a string and stores the string's reverse back into
   the array passed in */


int isPalindrome(char s[]) {
  char t[SIZE];
  strcpy(t,s);
  reverse(t); 
  return (strcmp(s,t) == 0);
}