|
-
Apr 5th, 2002, 10:00 AM
#1
Thread Starter
Hyperactive Member
empty array
how do i declare a 2D array which is empty?
like int array[][];
then then i can decide on the number of rows and cols based on what the user given
and how do i write function for a 2D array
void array(int array[][] ) ???
or
void array(int array[row][col] , int row , int col)
??
-
Apr 5th, 2002, 01:40 PM
#2
Frenzied Member
There is two ways to do this (FYI its called dynamically declared array).
The easiest way is to used linked list, which if you search this form you are bound to find alots of examples for.
The other way is to use new and delete to make a new array and to delete it. The hard part about doing it this way is you have to move the data out of your array delete it, resize it making using new, copy the data back, then delete your temp array. Again if you search this for you should find examples.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|