Questions tagged [dynamic-arrays]

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.

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.

1815 questions
0
votes
1 answer

Memory leak with dynamic array of mpfr variables in c++

I have a simple c++ program using the multiprecision library MPFR written to try and understand a memory problem in a bigger program: int main() { int prec=65536, size=1, newsize=1; mpfr_t **mf; while(true) { size=newsize; mf=new…
0
votes
2 answers

Dynamic array in main and in function

If I run this code like this it gives segmentation fault error. However if I put the for loop in main it works fine. I don't get it why it happens?
molten
  • 53
  • 1
  • 1
  • 8
0
votes
2 answers

Creating an array dynamically in JavaScript

OK, so I am attempting to write some code that will take x number of classrooms and x number of students per classroom and then pair two students together randomly from separate classrooms. Sounds Simple, right! I have already been able to create x…
Chris
  • 185
  • 1
  • 8
0
votes
1 answer

Is there a way to import and process an xml table as an array instead of putting it on a spreadsheet?

The question is really: How do I flush/prevent Excel from bloating my RAM. I have a bunch of html strings stored in a seperate Sheet which points to different xml web data and I´ve created a loop that: imports the xml´s (one by one) as tables to a…
10199045
  • 1
  • 2
0
votes
2 answers

assigned to a variable in php dynamic array by $ _POST

I have an array in Java, I dont know how many positions ArrayList postparameters2send = new ArrayList(); for(int i=0; i<4; i++){ try{ for (int e=0;e<10;e++){ …
0
votes
1 answer

Should I array or collection or what

my first post, so I hope I am keeping in the rules. I am converting to C# programming and I would appreciate being pointed in the right direction on this point. I have a stream of data consisting of integer pairs which I want to store. There could…
0
votes
1 answer

large matrix with dynamic array

I must create a large matrix (i.e. 10,000x10,000) with the spine as an array of float pointers: typedef float* DynamicMatrix[MAT_SIZE]; DynamicMatrix matDyn; Now i must allocate rows and initialize them to zero. // allocate rows and initialize…
tmacnadidas
  • 27
  • 1
  • 2
  • 10
0
votes
2 answers

Using global variable for array size in class

I want to define dynamic array h of size size and later in other functions, modify and use it as here: class definition: static int size=10; class hash{ public: string h[size]; hash(); void resize(); void operations(); …
Nikhil Chilwant
  • 629
  • 3
  • 11
  • 31
0
votes
4 answers

While Initializing An Object Array what are the defaults values

I have this array Cards[] temp = new Cards[13]; where Cards is a class having 52 object. as per my knowledge this statement will create an array which hold 13 objects of Cards data type. i just want to know before putting the value what values are…
Syed Fahad
  • 137
  • 9
0
votes
1 answer

How do I correct this allocation error

I am suppose to create a nested loop that cycles through a dynamically allocated array (story) find the char ''*', and fill in the position where this char is with information from the other dynamically allocated array (user_input). Then store this…
0
votes
2 answers

VBA how to use a dynamic array in a loop

I'm parsing a tab delimited txt file. Each line in the file contains 3 fields: 1. nCells - which is constant and must be the same for each line 2. product index 3. counter (how many products were purchased) I want to create an array that contains…
user429400
  • 3,145
  • 12
  • 49
  • 68
0
votes
2 answers

c++ dynamic array initialization crash

I have the following code where i call a function and create a dynamic array of ints and then fill that array with an algorithm main.cpp ... int main(void){ srand((long) 1234567); callFunction1(); return 0; } functions.h ... int…
stergosz
  • 5,754
  • 13
  • 62
  • 133
0
votes
1 answer

Trouble Resizing a 2D Array in C

I have a project where I create a 2D char array that stores words, with the option to add more words, and then resize the array when necessary. I'm getting a variety of errors as I try to play with it and fix it so now I think I need some extra eyes…
AKon
  • 79
  • 8
0
votes
2 answers

How to create a dynamic array vector without using stl?

I have to create and do some operations with dynamic array "vector", but without using stl and malloc. It should be in c. I have no idea how to do it, I googled it but all what I found is information about "vectors" in stl and no malloc(
Asm
  • 19
  • 1
  • 1
  • 4
0
votes
0 answers

Access Violation Writing Location while trying to Pass in Pointer to Array of Structs

I'm getting the title error at runtime inside method SetNameandOp on the lines where I try to add something to the RealList struct. I think I am referencing RealList wrong, but I am not sure how to correct it. Anyone have any thoughts? Here are the…
cmonnats23
  • 15
  • 1
  • 6
1 2 3
99
100