Answer:
Following are the function of array palindrome
bool ischeckPalindrome(int a1[],int n) // function definition
{
if( n== 0 || n == 1) // check the condition
{
return true; // returns true
}
else
if(a1[0] != a[n-1] ) // check condition
return false; //return false
else
return ischeckPalindrome( ++a1, n - 2 ); // portion of the array
}
Step-by-step explanation:
Following are the description of function .
- We declared the bool type function bool ischeckPalindrome(int a1[],int n) it returns true or false or any integer value .In this function we pass the array "a1[]", and the size of array i.e "n".
- In this we check the condition according to the need the if( n== 0 || n == 1) check the condition of array size 0 or 1 .If it executed it returns true .
- If this condition is not executed the control goes to the else block .In this else we have used inner if -else statement .
- The if(a1[0] != a[n-1] ) verify the condition if array index 0 is not equal a[n-1] then it returns false other it returns the portion of the array.
- Finally this function check the palindrome condition .