Dynamic Array

how to write a c++ program for a multi-dimensional dynamic array and get sum of its elements?
I think at this point, someone normally comes around and says you should try and do some of it yourself, and only then if you get stuck should you ask for help.

multi dimensional is just this:

 
char abc[0][0];
That's not a dynamic multidimensional array though.
ya thats not dynamic

int** x;
something like that is!
closed account (zb0S216C)
Simple enough:

1
2
3
4
5
6
7
8
9
int **Array( new int*[3] );

for( char I( 0 ); ( I < 3 ); ++I )
    Array[I] = new int[3];

int *End( *Array + ( 3 * 3 ) );
std::cout << ( End - *Array ) << std::endl;

// De-allocate... 


Wazzak
Last edited on
Gah, hate pointers, I did a quick google search and found someone ask the same question on here, and there is even a solution, perhaps you should try looking and see if you find it.

fyi I never said it was dynamic.
thnkx for the simple answer!


and btw I did search before I asked the question but I wanted a particular answer!
http://www.cplusplus.com/forum/beginner/63/

anyway, at least you have your answer.
Topic archived. No new replies allowed.