Checking for Palindrome
An efficient way of checking if a string is a palindrome.
Procedure :
C Function :
int checkPalindrome(char a[], int n) {
int i = 0, j = n-1;
for (i = 0, j = n-1; i < j; i++, j--) {
if (a[i] != a[j]) {
return 0;
}
}
return 1;
}Last updated