Ok so here's the code:
#include <iostream>
using namespace std;
int main()
{
int size = 10;
int array[size] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
array[10] = 10, array[11] = 11; // Setting values higher than the array
cout << array[10] << endl << array[11] << endl;
}
My question is simply why can I set array[10]
& array[11]
when we can't set value to an array greater than it's size?
Shouldn't C++ NOT support dynamic array's? I know I'm misunderstanding something.