merrimanjd
Programmer
Hello,
I am having some trouble using multidimensional arrays with pointers. I am able to create the array whatever size I want with this code from
float (*temp)[3];
temp = new float[2][3];
temp[0][0] = 2.345;
...
The only important differences are that I am not using floats, I am using a type of my own creation, and the user decides the size of the array in the program. I am new to creating arrays like this and don't know how to do a couple of things:
1. I know that if I create a multidimensional array the 'normal' way, then in function prototypes I have to explicitly give the sizes of all but the first dimension. What am I supposed to do if all the dimensions unknown until run-time?
2. Also on the idea of functions, could someone give me examples of function calls and bodies besides the prototype?
3. Is there anything else I should know about using this kind of array?
I am using Borland's command line C++ compiler.
Thanks,
Jesse Merriman
jesse_m14020@yahoo.com
I am having some trouble using multidimensional arrays with pointers. I am able to create the array whatever size I want with this code from
float (*temp)[3];
temp = new float[2][3];
temp[0][0] = 2.345;
...
The only important differences are that I am not using floats, I am using a type of my own creation, and the user decides the size of the array in the program. I am new to creating arrays like this and don't know how to do a couple of things:
1. I know that if I create a multidimensional array the 'normal' way, then in function prototypes I have to explicitly give the sizes of all but the first dimension. What am I supposed to do if all the dimensions unknown until run-time?
2. Also on the idea of functions, could someone give me examples of function calls and bodies besides the prototype?
3. Is there anything else I should know about using this kind of array?
I am using Borland's command line C++ compiler.
Thanks,
Jesse Merriman
jesse_m14020@yahoo.com