-
October 19th, 2009, 08:55 PM
#1
Alocating damanice memory link list .....
hi everyone here is what I am trying to do.
I am building a link list which the element are [last|element |next];
which the link list 2 directional [do not worry about it ...]
any way the issue is that he [ELEMENT ] is a damanic array of ints, because I do not know the size of the array off hand.
SO: my question: how should I define in my list.h?
in list.h
private:
?????? row; // what should be the type??? int*?
ListNode * next;
ListNode * previuse;
ALSO:
how would I set the element assuming I have
in main() ; I have :
int* a = {1,2,3,4 ,5,6,7,8,9,....} //we do not know how long assuming length = n
int *b;
List listing;
listing.setrow(a); //save it
b = listing.getrow();
what should my list.h should look like to save and return it ?
??????? List::getrow(); // maybe int*? I do not know
void setrow(?????? a);
and finally how should they look like in list.cpp???
Tags for this Thread
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
|