C Program to reverse array using recursion

Simple C program to reverse array using recursion: If array is {2,4,7,2,8} then program will print {8,2,7,4,2}.
#include<stdio.h>
void PrintArr(int arr[],int size)
{
 if(size<0)
 return ;
 printf("%d ",arr[size]);
 PrintArr(arr,size-1);
 
}
int main()
{
 int arr[5]={2,9,3,4,7};
 PrintArr(arr,4);
 return 0;
}

Popular posts from this blog