From: Abhishek on
Initializing an array via a variable is restricted in C++.

int a=5;
int arr[a];//error

I checked it in GNU compilers to my astonishment that this code really

Also suppose an array is declared to hold 5 data.i.e.

int arr[5];

Now, if you try to assign value to array element even greater than 5,
the compiler doesnt have a problem.

arr[7]=10;//this works

Kindly solve the doubt as to what is going wrong.

[ See for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Pages: 1
Prev: Right Endian conversion
Next: C/C++ query