Re: questions about Eu and C
- Posted by Al Getz <xaxo at AOL.COM> Nov 07, 2000
- 516 views
I dont think you can allocate variable length arrays in C but in C++ the 'new' command works for that as well as other things too. The first dimension must still be constant however. C++ Example code: //dim1 and dim2 are dimensions of array //makes a dim1 x dim2 array of type 'char' char** lpArray; ulong jarray; ulong MakeArray(void) { lpArray=(char**)new ulong[dim1]; for(jarray=0;jarray<dim1;jarray++) lpArray[jarray]=new char[dim2]; return ulong(lpArray); } //cleanup: ulong DistroyArray(void) { for(jarray=0;jarray<dim1;jarray++) delete[](lpArray[jarray]); delete[]lpArray; return 1; } --AL