
Write a function that reports whether the first n values of a are in ascending order, where two equal neighbours still count as ordered.
const int a[] = {1, 2, 2, 5}; is_sorted(a, 4);Expected result
1For your own tracking. Tests grade your code.
const int a[] = {4, 1, 9}; is_sorted(a, 3);Expected result
0const int a[] = {7}; is_sorted(a, 0);Expected result
1const int a[] = {INT_MIN, INT_MAX}; is_sorted(a, 2);Expected result
1Expected files
is_sorted.cAllowed functions
None. Write every helper yourself.
Allowed headers

v0.40: Create exercises. Challenge the community.
Meet Studio →Write a function that reports whether the first n values of a are in ascending order, where two equal neighbours still count as ordered.
const int a[] = {1, 2, 2, 5}; is_sorted(a, 4);Expected result
1For your own tracking. Tests grade your code.
const int a[] = {4, 1, 9}; is_sorted(a, 3);Expected result
0const int a[] = {7}; is_sorted(a, 0);Expected result
1const int a[] = {INT_MIN, INT_MAX}; is_sorted(a, 2);Expected result
1Expected files
is_sorted.cAllowed functions
None. Write every helper yourself.
Allowed headers

Run the tests to grade your code
Build your code, then check each test here. Open a result to inspect its output.