dynamic 2D array creation error
Hello. What's wrong with this code snippet?
lBucket = new int*[iWorldSize];//iWorldSize is the nummber of processors
lBucket[i] = new int[m];
Thanks in advance
You haven't given us much to go on.
The code snippet appears correct to me.
But why not go the simpler way, and use a vector of vector of int?
That way you won't have to worry about delete
'ing the new
std::vector<std::vector<int> > lBucket(iWorldSize, std::vector<int>(m));
// we can now use lBucket[i][j] where
// i >= 0 && i < iWorldSize and
// j >= 0 && j < m
Topic archived. No new replies allowed.