Please refere the following program
#include<iostream.h>
#include<conio.h>
using namespace std;
int main()
{
int a[10]={1,2,3,4,5,6,7,8,9,10};
cin>>a[-1];
cin>>a[15];
cout<<a[-1]<<" " <<a[15];
getch();
}
To my surprise this code works perfectly ok. I thought it will give me some compiler error or runtime error as I am writing in the array index which is undeclared.
My question is
1. What this declaration a[10] means.
2. Is it that in C++ the array bounds are flexible?
3. Or is it a bug in C++