Linked Questions

1 vote
1 answer
636 views

For one of my program I need large memory, I have done this with two different implementations, these are as follows: int SIZE = 1000000000; int[] rnums = new int[SIZE]; byte[] d1 = new byte[2 *...
User_67128's user avatar
  • 1,250
0 votes
2 answers
250 views

I have an issue understanding some things about arrays in C++. If I have array with 3 rows and 4 colomns and I create them as 1d array and accessing each row data by looping through the array by 4 ...
ahmed nader's user avatar
1 vote
0 answers
228 views

To access a matrix we can use a double pointer, and then use 2d arrays with index i, j. for rows a column. For example the element (1,2) could be addressed as A[1][2]. Another method is to use ...
Afnan Abdullah's user avatar
-3 votes
1 answer
97 views

static int ud[] = new int[] { 0, 0, 1 }; static int lr[] = new int[] { -1, 1, 0 }; static int dirs[][] = { { 0, 1 }, { 1, 0 }, { 0, -1 } }; public static int solve(int r, int c, int dir) { if (...
Yong D's user avatar
  • 91
0 votes
0 answers
82 views

If we had two arrays, bool trueFalse[10][10]; bool falseTrue[100]; and we looped through them like this: for(int i = 0; i < 10; i++) { for(int k = 0; k < 10; k++) { trueFalse[i]...
Daniel's user avatar
  • 588
2560 votes
8 answers
402k views

What does copying an object mean? What are the copy constructor and the copy assignment operator? When do I need to declare them myself? How can I prevent my objects from being copied?
fredoverflow's user avatar
526 votes
10 answers
211k views

What is meant by Resource Acquisition is Initialization (RAII)?
John's user avatar
  • 5,267
20 votes
7 answers
16k views

I'm new to C++ and I'm using the vector class on my project. I found it quite useful because I can have an array that automatically reallocates whenever it is necessary (ie, if I want to push_back an ...
Karl's user avatar
  • 384
11 votes
6 answers
45k views

I have a 3D string vector in C++: vector<vector<vector<string>>> some_vector That I am trying is to find a fast method to allocate memory for it. I tried to define it with two ...
ChangeMyName's user avatar
  • 7,498
8 votes
3 answers
7k views

I've read that a vector-of-vectors is bad given a fixed 2nd dimension, but I cannot find a clear explanation of the problems on http://www.stackoverflow.com. Could someone give an explanation of why ...
Jonathan Mee's user avatar
  • 39.1k
9 votes
3 answers
1k views

I am implementing the C++ multiplication for matrices with different data structures and techniques (vectors , arrays and OpenMP) and I found a strange situation... My dynamic array version is working ...
carlos.baez's user avatar
  • 1,153
4 votes
3 answers
12k views

How can I work with a 3 dimensional vector in C++? vector<vector<vector<int> > > vec (1,vector<vector<int> >(1,vector <int>(1,12))); When I try something like this ...
NonSense's user avatar
  • 173
1 vote
4 answers
8k views

Is it faster to represent at 2D matrix as an array of arrays, or as a 1D array with a function that converts co-ordinates to the corrisponding array index?
DrVonTrap's user avatar
0 votes
7 answers
6k views

Im trying to declare a pointer to a 2d float matrix in order to have a dynamical behaviour of my image data but Im having a compilation error C2057: expected constant expression. I thought a pointer ...
Nicolai's user avatar
  • 343
1 vote
1 answer
17k views

I'm trying to write a program in C++ which is able to multiply matrices. Unfortunately, I'm not able to create a matrice out of 2 vectors. The goal: I type in the number of rows and the number of ...
Earless's user avatar
  • 171

15 30 50 per page