carraysstatic-allocation

Can I increase the size of a statically allocated array?


I know its possible to increase the size of a dynamically allocated array.

But can I increase the size of a statically allocated array? If yes,how?

EDIT: Though this question is intended for C language, consider other languages too.Is it possible in any other language?


Solution

  • Simple answer is no, this cannot be done. Hence the name "static".

    Now, lots of languages have things that look like statically allocated arrays but are actually statically allocated references to a dynamically allocated array. Those you could resize.