
The starter loads a[i] before it checks anything: repair at_or_default so the element is fetched only after i is proven to be an index of a, and fallback is returned in every other case.
at_or_default({10, 20, 30, 40, 50}, 5, 2, -1)Expected result
30For your own tracking. Tests grade your code.
at_or_default({10, 20, 30, 40, 50}, 5, -1, 777)Expected result
777at_or_default({10, 20, 30, 40, 50}, 3, 3, -1)Expected result
-1at_or_default(NULL, 0, 3, 1234)Expected result
1234Expected files
index_guard.cAllowed functions
None. Write every helper yourself.
Allowed headers

v0.40: Create exercises. Challenge the community.
Meet Studio →The starter loads a[i] before it checks anything: repair at_or_default so the element is fetched only after i is proven to be an index of a, and fallback is returned in every other case.
at_or_default({10, 20, 30, 40, 50}, 5, 2, -1)Expected result
30For your own tracking. Tests grade your code.
at_or_default({10, 20, 30, 40, 50}, 5, -1, 777)Expected result
777at_or_default({10, 20, 30, 40, 50}, 3, 3, -1)Expected result
-1at_or_default(NULL, 0, 3, 1234)Expected result
1234Expected files
index_guard.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.