Write a recursive function that checks whether an array is sorted.
Prototype : int is_sorted(int tab[], int N)
Write a main function to test your program.
Difficulty level

This exercise is mostly suitable for students
int is_sorted(int t[], int N)
{
if(N==0)
return 1;
if(t[N]<t[N-1])
return 0;
return is_sorted(t,N-1);
}
Back to the list of exercises
Looking for a more challenging exercise, try this one !!
