Quiz: This function can segfault even when `array` and `size` are valid. Why?

char checkedGet(char* array, size_t size, size_t index) {
// Get the character at the given index in the array, if it is
// in-bounds. If not, return 0.

char* target = array + index;
if (target >= array && target < array + size) {
return *target;
} else {
return 0;
}
}
Shared publiclyView activity