Top "Dynamic-arrays" questions

Anything related to dynamic arrays, i.e. array-like data structures where the length of the array (the number of its elements) can be changed at runtime, thus allowing adding or removing elements without explicit memory allocation and management.

int[n][m], where n and m are known at runtime

I often need to create a 2D array with width and height (let them be n and m) unknown at …

c++ arrays multidimensional-array dynamic-arrays
Is a dynamic array automatically deallocated when it goes out of scope?

in this example procedure foobar; var tab:array of integer; begin setlength(tab,10); end; is the array destroyed or the …

delphi memory-leaks reference-counting dynamic-arrays
TStringList, Dynamic Array or Linked List in Delphi?

I have a choice. I have a number of already ordered strings that I need to store and access. It …

delphi data-structures linked-list tstringlist dynamic-arrays
Initialize a 2d dynamic array in Go

I am trying to create a 2d array in Go: board := make([][]string, m) for i := range board { board[i] = …

arrays multidimensional-array go dynamic-arrays
dynamic array size determined at runtime in ada

Is it possible to have an array with size that is determined at runtime like so, Procedure prog is type …

ada dynamic-arrays
How to get priorly-unknown array as the output of a function in Fortran

In Python: def select(x): y = [] for e in x: if e!=0: y.append(e) return y that works as: …

python arrays fortran dynamic-arrays
Why both runtime-sized arrays and std::dynarray in C++14?

Draft C++14 includes both runtime-sized arrays and the std::dynarray container. From what I can tell, the only real difference …

c++ c++14 dynamic-arrays dynarray
realloc: invalid next size, detected by glibc

My code: int args_size = 5; char** args; args = (char**) malloc(sizeof(char*) * args_size); // ... args = (char**) realloc(args, sizeof(char*) * (…

c size realloc dynamic-arrays
How to declare 2D c-arrays dynamically in Cython

I need to perform a lot of work using 2D numpy arrays of various sizes and I would like to …

c numpy cython dynamic-arrays memoryview
Deleting elements of a dynamic array one-by-one

I want to delete a dynamically-allocated array by looping through all the elements and calling delete on each of them. (…

c++ pointers memory-management dynamic-arrays