Все вопросы: [dynamic-arrays]
8 вопросов
C ++ - указатель на одно значение такое же, как динамический массив размера 1?
У меня есть этот фрагмент кода, который я собираюсь упростить: if (numberOfResults > 1) { trackResult_ = new TrackResult[numberOfResults]; for (int i=0; i < numberOfResults; i++) { // Make a deep copy TrackResult tempResult = result[i]; ...
Как "смотреть" динамический массив C ++ с помощью gdb?
Рассмотрим следующий пример: int size = 10, *kk = new int[size]; for (int i = 0; i < size; i++) { kk[i] = i; } delete [] kk; Как я могу добавить часы для всего массива?Я могу добавлять часы по одному ( kk [0] , kk [1] ...), но, поскольку я знаю длину массива, есть способ сделат...
C++ Array size x86 and for x64
Simple question, I'm writting a program that needs to open huge image files (8kx8k) but I'm a little bit confused on how to initialize the huge arrays to hold the images in c++. I been trying something like this: long long SIZE = 8092*8092; ///8096*8096 double* array; array = (double*) mall...
C++ Dynamic Array Access Violation
**** Sorry for the confusion regarding numCars in the original post. I modified the code to be consistent with the original ****** The following academic program is a simplified version of the original problem but it focuses on the issue that I have yet to resolve. There are 2 classes and a main...
C++ dynamically allocated array of statically dimensioned arrays
I need to create a structure that holds a variable number of 'char[2]'s, i.e. static arrays of 2 chars. My question is, how do I allocate memory for x number of char[2]. I tried this (assuming int x is defined): char** m = NULL; m = new char[x][2]; ... delete [] m; (it didn't work) I realis...
Problems deleting a 2D dynamic array in C++ (which is eventually store in a vector)
So I have this 2d dynamic array which content I want to free when I am done with it. However I keep running into a heap corruption after the destructor. The code works fine (of course with memory leaks) if I comment out the destructor. (Visual Studio 2005) FrameData::FrameData(int width, int hei...
Какова идеальная скорость роста для динамически выделяемого массива?
В C ++ есть std :: vector, а в Java - ArrayList, а во многих других языках есть собственная форма динамически выделяемого массива. Когда в динамическом массиве заканчивается пространство, он перераспределяется в большую область, а старые значения копируются в новый массив. Центральным вопросом д...
Как объявить массив, если я не знаю его длину до времени выполнения?
Изначально у меня был массив [1..1000], который был определен как глобальная переменная. Но теперь мне нужно, чтобы это было n, а не 1000, и я узнаю n позже. Я знаю, что такое n, прежде чем заполняю массив, но мне нужно, чтобы он был глобальным, поэтому мне нужен способ определения размера глоба...