Practice ยท 1 of 3
Fix: Off-by-One
copy_all(int *dst, const int *src, int n) writes one element PAST the end. Fix the loop bound (the tests place a sentinel after the array and check it survives).
``c
void copy_all(int *dst, const int *src, int n) {
for (int i = 0; i <= n; i++)
dst[i] = src[i];
}
``
Difficulty: beginner
Press Submit to check your solution.
Back to lesson: Practice: Crash Forensics