1,877 questions
1
vote
1
answer
122
views
dynamically resizing array in queue implementation [closed]
I'm trying to write a queue that will store strings. Using GDB I can tell that I make a memory allocation error in the function resizeQueue.
Here's the exact message:
Program received signal SIGTRAP, ...
11
votes
2
answers
366
views
Issue with aggregate initialization with the new operator
The following two codes behave as expected:
char* test1 = new char[20]{"abc"};
cout << test1;
Outputs: abc
int size = 20;
char* test1 = new char[size]{'a','b','c'};
cout << ...
3
votes
1
answer
169
views
C++: dynamic array unexpectedly working and on the scope of variables
I'm super duper new to coding and I'm just learning this as a hobby. I'm following a course and this is the code I wrote (user input to a dynamically created array):
#include <iostream>
using ...
6
votes
2
answers
201
views
Associativity of '*' operator in a 'new' statement in C++
I have a user-defined class Person and I want to create a variable-sized array (size taken at runtime) of Person pointers.
The following code works as expected.
Person **arr = new Person* [size];
...
0
votes
0
answers
44
views
How to use complex formulas in data validation via VBA without Excel adding the @ symbol? [duplicate]
I'm facing two related problems while working with VBA in Excel. Both involve complex formulas, but they behave differently when set through VBA compared to when entered manually in the Excel UI.
...
-3
votes
1
answer
171
views
Memory is not being allocated [closed]
I am sorry if the question is stupid. The problem is that memory for my dynamic array inside a static structure is not being allocated. The reason might be my pc (it is a really old notebook with only ...
0
votes
2
answers
84
views
Adding SORT or SORTBY into excel function
I am looking to add a sortby or sort function into my query but can't figure out how.
=TAKE(CHOOSECOLS(FILTER(Revenue,(Revenue[Top Product]=$C$66)*(Revenue[Location]=$C$67)),1,2,17),10)
Here is what ...
0
votes
2
answers
161
views
Is this truly best way to delete last element in C? [closed]
I have a code where I need to delete last element of array. I made this code but I am wondering is there a more optimised way of doing this?
My version:
void DeleteLast(int** array, int* size)
{
...
0
votes
1
answer
218
views
Excel Filter Function based on a variable sized array of conditions + inputting results into a 2x2 grid
I am looking to make a pre-existing function more dynamic such that the user can readily change the filter conditions without needing to delve into the formula and changing manually. I would prefer a ...
-1
votes
1
answer
90
views
How do I manipulate this dynamic vector for fold operations
I am working with flex/bison to create an interpreter for a class. The problem that I am encountering seems to be related to using/converting a dynamic vector. I am trying to create a function to ...
1
vote
2
answers
186
views
How to keep a pointer to a Dynamic Array valid after resizing the array?
I have a dynamic array, and I need to maintain a pointer to it. Here's the setup:
var
Controls: TArray<TControls>;
Items: ^TArray<TControls>;
begin
Items := @Controls;
end;
The ...
1
vote
2
answers
439
views
Access JSON strings with different keys using Databricks SQL
I have a array with JSON strings and each JSON has a different key. Also, the size of the array is not fixed and may increase or decrease in occurrences.
An example of this is below :
"[{"...
0
votes
2
answers
103
views
Dynamic array first element remove complexity
I was reading about CPython’s implementation of list.pop(k) method and learned that it takes O(n-k) to remove the kth element of the list since it needs to move the posterior elements one position to ...
0
votes
1
answer
113
views
Is there any way at all to get the size of a dynamic array with sizeof()? [duplicate]
I'm a computer science student and one of the questions on a test asked to implement realloc in C using malloc. My teacher said the correct answer would be to get the sizeof of the previous array and ...
0
votes
1
answer
57
views
During the second call of strtok(), the code raises the following error: Invalid read of size 1
I am new to C++ and I do not understand why the code doesn't continute tokenizing the text array, and instead raises the error.
I suspect that the problme might be because of passing the token ptr mid-...
6
votes
6
answers
599
views
Excel - Aggregate dynamically values in a Table using array formulas (MAP, BYROW, CHOOSECOLS, TEXTJOIN, LAMBDA, FILTER, HSTACK) in a single Cell
I would like to aggregate, merge, compact some values as shown below
The input is a table and the output is dynamic array formulas on a single Cell and has a goal to aggregate other columns based on ...
1
vote
0
answers
64
views
passing 2d c array to labview [duplicate]
I want to create a dll that gets some data and put them in a 2d array and then pass it to labview
the problem is all I get is a pointer instead of the whole array
I allocate array in c by using malloc ...
0
votes
0
answers
36
views
How does ctypes.py_object works?
I have been studying DSA and don't understand how ctypes.py_object works. As of my knowledge it works on concept of pointers to create an array of pointers that will store memory addresses for values ...
0
votes
2
answers
60
views
Excel MS365: 2-D dynamic array creation problem
I have an Excel problem that boils down to the following:
Given the input range A1:B3 (a 2-D array), is it possible to use only formulas to create the output D1:K3? I would like to use the input ...
0
votes
0
answers
164
views
Excel: Applying SUBTOTAL() within VSTACK() (for a Sum of a Filtered Column)
INTRODUCTION / DESIRED RESULT
I am trying to create a table that automatically updates and that can be filtered. In this table, I want to add a dynamically column total at the end of the 'time ...
1
vote
1
answer
89
views
Declaration of dynamic array before getting array length [duplicate]
In dynamic allocation of arrays at runtime, when the array is declared before getting the array length, I encountered a behavior that could not explain.
In the following code, the user provides the ...
0
votes
1
answer
218
views
Store dynamic arrays in a hash table in Golang?
In Go, people use "slices" as dynamic arrays, because plain arrays have sizes that should be known at compile time.
But while equality is conceptually simple for dynamic arrays, Go does not ...
2
votes
0
answers
85
views
R openxlsx - how to create overflowing array formula?
I am trying to create an overflowing array in R using openxlsx. My end result will have the user change items into row 1, so I need the UNIQUE formula to dynamically add/remove values after exporting.
...
2
votes
2
answers
58
views
Dynamic dimensional array storing in Matlab
I have M many 2-D matrices of dimension (2 x n_1 ,2 x n_2 , 2 x n_3,..., 2 x n_N ). I can store them in a MATLAB cell-array of dim (2 x N x M) where N = {n_1 , n_2 , n_3,..., n_N} and n_1,n_2,n_3 are ...
0
votes
1
answer
48
views
Why is This _Generic Statement Giving an "Expression expected" Error?
I am writing an implementation of a dynamic array in C11. The keyword _Generic comes along with the C11 standard and is supported in my version of GCC (14.1.1) as far as I know. I have worked with it ...
1
vote
0
answers
107
views
Using dynamic arrays in OpenMP loop gives different results of the serial
The following function compute the square matrix arrayrmsd, but the result is different depending on the value of export OMP_NUM_THREADS=x (x = number of cores used). Differences are low but ...
4
votes
3
answers
226
views
Creating a sequence table with different column counts [duplicate]
I'm hoping to create a TOCOL in excel of an array of values based on variable criteria.
Eg. When it meets one criteria, I wish for it to be able to return an array of values associated with that ...
1
vote
1
answer
58
views
Binder Bookmark database using dynamic arrays
I'm trying to work through one of the assignments for MITOpenCourseware's Introduction to Algorithms:
Sisa Limpson is a very organized second grade student who keeps all of her course notes on ...
0
votes
1
answer
39
views
Converting a dynamic string array to an object with keys
I have the following string array:
let arrayExample = ['', 'test1', 'test2', '', 'test3', 'test1', ''];
This is also dynamic, so the size can change at any given time. I would like to be able to ...
3
votes
4
answers
318
views
Dynamic array formula to summary weekly data (like a pivot table)
I have been wrestling with ChatGPT (and losing) trying to find an answer to this one.
This is a sample of weekly data displayed in A2:D43021 of Sheet1.
DATE
ARTIST
SONG
THIS WEEK
1/3/1970
Diana Ross &...
2
votes
1
answer
185
views
Does redim use the heap or the stack memory in VBA?
I know this is quite strange to ask for a language that is far from a low-level language such as C and C++, but it caught my attention that for example if I do this:
Dim tempArray(0 To 2) As Integer
...
0
votes
0
answers
218
views
C++ static void _Xout_of_range("invalid string position")
[Solved]Edit2: So I figured out the issue and replaced the at function by putting the array strings into a string to assess the positions in the string. THis still caused an issue when reading spaces, ...
0
votes
1
answer
41
views
free of struct 1 with an array of struct 2, inside of struct 2 there is an array of int
typedef struct partition_struct {
int* elements;
int last; //last element index
int dim; //n allocated int
} partition;
typedef struct partitions_struct {
partition* partitions;
...
0
votes
1
answer
216
views
Xlookup in excel doesnt function in Makearray?
There appears to be an error in excel formula when combining XLOOKUP with MAKEARRAY formula:
e.g.
This is a simplified example. I have used y values of constant increments to make the formula easier ...
0
votes
2
answers
129
views
Converting complex Formula into Dynamic Array
Trying to create a Dynamic array from a somewhat complex formula but keep getting #N/A errors randomly.
For some reason, the y value of the equations doesn't like it.
Effectively the #N/A for the ...
0
votes
1
answer
81
views
How would I make a flexible struct inside another struct?
I'm trying to create an item and box system, where a box can have a flexible amount of items inside it (i.e. not wasting memory by making every box have 50 items, when some will have just a few). I am ...
-2
votes
1
answer
79
views
Choosing Named Range via formula
So I have this formula:
At a high level, the formula goes like this:
If [Dynamic Array #1] = False, 0,
Index(
If [Dynamic Array #2] = 1, Named Range A, Named Range B <-- Problem ...
6
votes
5
answers
626
views
Using Office365 excel array formulas, how to remove duplicates, keeping the last value?
With data in A1 - B5:
A 1 //remove
A 2
B 3 //remove
B 2
C 1
How do you remove duplicates in column A, keeping the last set of values in other columns? Results should look like this:
A 2
B 2
C 1
I'...
0
votes
2
answers
58
views
SIGBUS Error while accessing pointer in Implementation of Dynamic Arrays
It is just a partial implementation of dynamic arrays, all functions haven't yet been implemented and wanted to just check the working of a function.
This is the code
#include <stdio.h>
#include ...
0
votes
0
answers
22
views
I can't access an array that was dynamically allocated inside the function [duplicate]
I want to allocate memory for a two-dimensional array of char in a separate function. I defined a double pointer in the main function, then I passed this pointer into my separate function alloc_arr(), ...
0
votes
2
answers
710
views
Excel Filter Function on an Array Result
For background, my job requires me to make up large amounts of mock data. Large like 100s of thousands of rows, and array formulas seem to be the best option to scale these activities. Onto the ...
1
vote
2
answers
605
views
How to make a spilled array formula in Excel with MATCH or XLOOKUP that do not skip rows
I have generated a spilled array function that returns a value if two conditions are met. I have a raw data table with all my data, and then I have "my table", which is the table where I ...
0
votes
4
answers
93
views
Dynamic array in C pass by pointer
To make it straight forward: one can see there are two function declaration below.
void tableau_initialize(int Rn, int slack_num, int Cn, int A[Rn][Cn], int B[Rn], int C[Cn+1], float ***A_tableau, ...
0
votes
1
answer
57
views
How can I create a square 2-dimensional dynamic array in Excel: e.g. 5x5 top row all 1s, next row one 0 and four 1s, next row two 0s and three 1s etc
I want to use and Excel formula, not VBA, to create an array with the following values:
The formula must allow the range to grow dynamically as a copy it down horizontally and vertically.
There are a ...
-1
votes
1
answer
66
views
Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
Sorry for my bad english)
I created a dynamic array of structures. This structures contains dynamic array of doubles.
When I add the structure, I fill it this way
The number of sides and the length of ...
1
vote
1
answer
203
views
Excel dynamically calculate cost of products based on bill of materials (BOM) and purchase price history
EDIT 1 → 2024-03-30:
Included parameters in the lambda functions so the table names and columns may be injected by the user
Updated lambda functions with such paramteres
Even though I found a ...
1
vote
1
answer
99
views
EXCEL problem -> Function that searches for correct column based on headline and returns specific cells if they match values listed on list
I am working with a relatively large dataset, which has been extracted from MIKE+ and into Excel. The real dataset is about pipes, where I need to return all the pipes that are the same materials.
...
0
votes
2
answers
117
views
C++ Dynamic Array for Class Object of different variable types
I'm trying to write a dynamic array that will allow me to enter a unique number of vehicles through the function addVehicle but im struggling on how to use the array and add items to it.
I read that ...
1
vote
2
answers
154
views
What value to assign to a char* in default constructor c++?
I have a class String and I've made a field char* name, default, parameterized, copy constructor, destructor and overwritten operator =.
My question is how my default constructor should look like for ...
1
vote
1
answer
1k
views
How to insert blank rows between data using dynamic array formula?
If you have 5 rows of data with values 1,2,3,4,5, how can a dynamic array formula be used to create 10 rows of data by inserting a blank item after each element. So the results should be an array of ...