1,878 questions
1
vote
1
answer
119
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
356
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
162
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
198
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
39
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
169
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
75
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
158
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
184
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
81
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
181
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
380
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
101
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
104
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-...