Write a recursive function testing whether a specific element is in an array.
Prototype : int in_array(int tab[], int N, int element)
Write a main function to test your program.


Difficulty level
This exercise is mostly suitable for students
int in_array(int t[], int N,int e)
{
	if(N<0)
		return 0;
	if(t[N]==e)
		return 1;
	return in_array(t,N-1,e);
}

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Ancestor sum in binary trees