[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
2-D arrays in C++
This question is not directly related to game development, but I ran across
it while working on my game and I thought others might find it useful, so
How do you dynamically allocate a 2-D array in c/c++?
For a one dimensional array you can do something like...
So, for a two dimensional array I would like to do something like...
This does not work though, because new int has a return type of
int(*) not int**.
p.s. I know there are work arounds such as this:
or something like this:
for(int i=0;i<6;i++) x[i]=new int;
What I'm looking for is the correct way to handle the return type from new