Finding if an array is palindrome using recursion | in c

preview_player
Показать описание
comment below if you have any question and what do you want for the next video✌

tags:
#clanguageforbeginners #c #clanguageforbeginners
Рекомендации по теме
Комментарии
Автор

code:

void main()
{
int arr[] = { 1, 2, 3, 2, 1 };
int n = 5;

/*int result = isArrayPalindrome(arr, n);
if (result)
printf("the array is palindrome!");
else printf("the array is NOT palindrome!");*/

int result = IsPolindromRecursion(arr, n);
if (result)
printf("the array is palindrome!");
else printf("the array is NOT palindrome!");
}

int IsPolindromRecursion(int* arr, int size)
{
if (size <= 1)return 1;
if (arr[0] != arr[size - 1])return 0;
IsPolindromRecursion(arr + 1, size - 2);
}

c_language