class array {
public:
int arr[];
array() {
arr[0] = 1;
arr[100] = 2;
}
};
int main() {
array a;
cout << a.arr[0] << a.arr[100] << endl;
return 0;
}
I was expecting a segmentation fault on running the above code. However, it printed the correct output even though I have not mentioned array size. What is the reason for this?