+ 2

Dynamic size array

i have a way to do that. int x = 10; const int &y = x; int arr[y]; x = 100; arr[80] = 99; the size is really change. but is this a good idea?

7th Mar 2018, 9:23 AM
Kevin AS
Kevin AS - avatar
1 ответ
+ 6
The size did not change, you did a buffer overflow Use malloc/realloc / free instead of "false static" arrays
7th Mar 2018, 12:54 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar