Title: [msvc] Re: dynamically allocated multi-dimensional array

Sreeram writes:

> Hello David,
>
> There are 2 ways to do this.

<snip>

> > 2. If array dimensions are unknown
>
> int a, b;
>
> int **nArray;  /*declaration*/
> cout << "Enter the value of a:";
> cin >> a;
> count << "Enter the value of b:";
> cin >> b;
> /*definition*/
> nArray = new int*[a];
> for (int i = 0; i < a; i++)
>     nArray[i] = new int[b];
>
> I think this is what you are looking for. I know only the above methods to initialize a 2-dimensional array dynamically. Hope some of this helps you.

This is the method that I was trying to remember.  Thanks!!!

Best regards,


David Stroupe
Keyed-Up Software

Reply via email to