Write a function that checks whether the string is palindrome. Must use recursive function and ignore spaces. I have done the first part but still not figure out how to ignore space. The following code is what I have tried already.
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>// this is used for strlen
#include <ctype.h>// this is used for isalnum
int checking_palindrome(char *string,int length);
int main()
{
int result,length;
char string[] = "a ma ma";
length = strlen(string);
result= checking_palindrome(string,length);
if (result == 1)
printf("The array is palindrome.\n");
else
printf("The array is not palindrome.\n");
system("pause");
return 0;
}
int checking_palindrome(char *string, int length)
{
if (length <= 0)
return 1;
else if (string[0] == string[length-1])
return checking_palindrome(&string[0], length - 2);
else
return 0;
}