dynamic-arrays Questions

3

Solved

I often need to create a 2D array with width and height (let them be n and m) unknown at compile time, usually I write : vector<int> arr(n * m); And I access elements manually with : arr[...
Isotherm asked 28/8, 2014 at 14:48

1

Solved

I am adding a formula to a worksheet via VBA which should be: =UNIQUE(IF(TableA[ColumnA]=A1,TableA[ColumnB],"")) This utilises the new SPILL feature in Excel to give me a list of column B values...
Talon asked 10/4, 2020 at 10:7

1

Solved

In the C++20 standard, it is said that array types are implicit lifetime type. Does it mean that an array to a non implicit lifetime type can be implicitly created? The implicit creation of such an...
Hildegardhildegarde asked 11/3, 2020 at 7:39

3

Solved

I am parsing an XML file through Android Pull Parser technique. First, have a look at the below XML file: <childs> <students> <name> hello </name> <address> xyz &l...
Headlight asked 11/8, 2010 at 9:20

3

Solved

I'm looping through a named range and appending an array based on if the cell is empty or not. I'm not too familiar with arrays in VBA, so perhaps my logic is incorrect. The code keeps overwriting ...
Branks asked 23/2, 2015 at 22:40

3

Solved

AFAIK, although we cannot create a 0-sized static-memory array, but we can do it with dynamic ones: int a[0]{}; // Compile-time error int* p = new int[0]; // Is well-defined As I've read, p acts...
Ralaigh asked 3/11, 2019 at 21:55

6

Solved

I want to create dynamically an array with N (without knowking N) elements. Something like a function public function create_array($num_elements){ ..... } that return me something like //c...
Orpha asked 18/7, 2011 at 8:45

7

Solved

I am currently reading my textbook and I am totally confused why a dynamic array would require O(n) time to delete an item at the end. I understand that deleting an item from any other index is O(n...
Abib asked 27/12, 2018 at 4:23

2

Solved

I was wondering how delete[] knows the size of a dynamically allocated array, and I found this question (and also this question on a Microsoft forum, but the answer is similar). Turns out the answe...
Ayacucho asked 11/12, 2018 at 13:44

3

I am trying to create a 2d array in Go: board := make([][]string, m) for i := range board { board[i] = make([]string, n) } However, given the verbosity of that, I am wondering if there is a bet...
Bulbiferous asked 26/5, 2014 at 12:2

3

Solved

I have this error with the following code: int main(){ point *points = malloc(sizeof(point)); if (points == NULL){ printf("Memory allocation failed.\n"); return 1; } other_stuff(points); fr...
Foetid asked 14/12, 2013 at 0:36

3

Solved

So I wrote a class that can parse XML documents and create SQL queries from it to update or insert new rows depending on the settings. Because the script has to work with any amount of nested bloc...
Panayiotis asked 28/4, 2011 at 15:13

1

Solved

I have a two dimensional array arr[cols][rows]. I want to know if the cols contains a string "hello". How can I check that using .includes("hello") method. Please note that I am trying to check th...
Yesseniayester asked 31/1, 2018 at 8:58

4

When I allocate a dynamic array in C++ (T * p = new T[n]), I use delete [] p to free the allocated memory. Obviously, the system knows the array size (in order among other things to call n times T'...
Zabrina asked 10/1, 2018 at 14:3

1

Solved

I have a procedure that takes a dynamic array TData = TArray<Byte> as a parameter. procedure DoStuff(const Input: TData); begin // do nothing end; And a function that returns a dynamic ar...
Deadwood asked 24/10, 2017 at 5:8

5

Solved

I found the following snippet in the C++03 Standard under 5.3.5 [expr.delete] p3: In the first alternative (delete object), if the static type of the object to be deleted is different from its d...
Dissipated asked 30/5, 2011 at 2:35

11

Solved

In PHP, you can dynamically add elements to arrays by the following: $x = new Array(); $x[] = 1; $x[] = 2; After this, $x would be an array like this: {1,2}. Is there a way to do something simi...
Nineteen asked 21/2, 2011 at 2:28

4

I am trying to build two dimensional array by dynamically allocating. My question is that is it possible that its first dimension would take 100 values, then second dimension would take variable am...
Thumbnail asked 12/11, 2013 at 3:41

1

Solved

I was comparing performances between these two ways of initializing a dynamic array: Arr := TArray<integer>.Create(1, 2, 3, 4, 5); and SetLength(Arr, 5); Arr[0] := 1; Arr[1] := 2; Arr[2] ...
Sackman asked 20/8, 2017 at 19:13

1

Solved

I am trying to initialise a list with a size in the constructor. But the size of my list is 0. val seqList = ArrayList<ArrayList<Int>>(N) // This has the Problem val queries = ArrayLis...
Berkman asked 13/8, 2017 at 14:31

2

Solved

I’m learning functions/pointers, and having a bit of an issue. What I need to write is a C program with main() and two other functions. Requirements: read_funct() must allocate enough memory usi...
Palazzo asked 9/4, 2017 at 1:39

2

I want to create an Array, if i make it like this it works: var arrayEingabe = Array(count:30, repeatedValue:0) If i make it like this it does not work: var sizeArray = 30 var arrayEingabe = Ar...
Aguilar asked 17/12, 2014 at 9:9

5

Solved

I'm trying to find a way to make a struct to hold a dynamic array that can work with any data type (Including user defined data types), so far this is what I came up with. #define Vector(DATATYPE)...
Untruth asked 17/2, 2017 at 8:42

5

I've started reviewing data structures and algorithms before my final year of school starts to make sure I'm on top of everything. One review problem said "Implement a stack using a linked list or ...

2

The dilemma: oncreated: the template is not yet rendered (fires only one time for each template). onrendered: the template is rendered (fires multiple times). Is it possible to fire a function ...
Besmirch asked 26/3, 2015 at 16:45

© 2022 - 2025 — McMap. All rights reserved.