Array First Occence

#include  <stdio.h>
 
int rLookupAr(int *ar, int n, int target);
 
int main()
{
    int a[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
 
    printf("rLookupAr() with 0: %d\n",  rLookupAr(a, 10, 0));
    printf("rLookupAr() with 3: %d\n",  rLookupAr(a, 10, 3));
    printf("rLookupAr() with 9: %d\n",  rLookupAr(a, 10, 9));
    printf("rLookupAr() with 20: %d\n", rLookupAr(a, 10, 20));
    printf("rLookupAr() with -1: %d\n", rLookupAr(a, 10, -1));
 
    return 0;
}
 
int rLookupAr(int *ar, int n, int target)
{
    if (n == 0) return -1;
    if (ar[0] == target) return 0;
 
    int _ret = rLookupAr(ar + 1, n - 1, target);
 
    if(_ret != -1) return ++_ret;
    else          return -1;
}
RITESH KUMAR