+ 2

Blank size

if we omit the size of an array int a[]; does it give error?? coz , in c language it does give error.

19th Jul 2017, 4:48 PM
Jay Vanraj
Jay Vanraj - avatar
2 Respostas
+ 3
This is one of those I'd just try :) Error: storage size of 'a' is not known. The compiler has to know how much space to allocate because it goes in a specific segment during bootstrap (start up) of the compiled binary. This is not a c/c++ thing...it's an OS thing. To get around this, one option is dynamic allocation.
19th Jul 2017, 4:56 PM
Kirk Schafer
Kirk Schafer - avatar
0
It gives error in compiled languages using static arrays, you should make dynamic arrays or vectors It doesn't in some scripting languages where arrays are always dynamic, like JavaScript.
19th Jul 2017, 5:48 PM
Andrés04_ve
Andrés04_ve - avatar