Trying to access an array element that is not there invokes
undefined behavior. We say we are
reading out of bounds. The following example demonstrates a common scenario of trying to access a nonexistent, out of
bounds array element:
int main(void)
{
int arr[5] = {10, 20, 30, 40, 50};
printf("Trying to read out of bounds...\n");
printf("The non-existent array element is: %d\n", arr[5]);
}
Possible Output:Trying to read out of bounds...
The non-existent array element is: 32767
In this example, we declared an array of five integers. We then ...