C Program to print array using recursion

Simple C program to print array using recursion.
/* Print array using recursion */
#include<stdio.h>
void PrintArray(int arr[],int n)
{
 if(n<0)
 return ;
 PrintArray(arr,n-1);
 printf("%d ",arr[n]);
}
int main()
{
 int arr[6]={4,12,9,34,6,8};
 PrintArray(arr,5);
 return 0;
}
/* End of program */


Popular posts from this blog