Author |
Message |
tum_twish
|
Posted: Thu Jun 05, 2003 10:35 am Post subject: Deleting elements in an array |
|
|
Is it possible to delete an element (parition)of an array (ie. make it no value) given the index (subscript) of the element? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Martin
|
Posted: Thu Jun 05, 2003 10:49 am Post subject: (No subject) |
|
|
Nope. Just set it to a flag value that you know isn't going to be used, or use linked lists |
|
|
|
|
|
tum_twish
|
Posted: Thu Jun 05, 2003 10:53 am Post subject: (No subject) |
|
|
what r linked lists? |
|
|
|
|
|
Martin
|
Posted: Thu Jun 05, 2003 10:57 am Post subject: (No subject) |
|
|
It's a really efficient way to store data.
Basically you have a pointer to the first memory location of a record, and then each subsequent record has a pointer to the next one in line
code: | type list :
record
x,y : int %just to make the record hold something
next : ^list %Pointer to the next node
end record |
you then have a variable and set that = to nil. Then, whenever you want to add a new element to the list, you allocate a new memory location for a new node, and add that to the end of the node. I'll write a tutorial on this later. |
|
|
|
|
|
Blade
|
Posted: Thu Jun 05, 2003 11:19 am Post subject: (No subject) |
|
|
i kinda thought he was talking about flexible arrays.. |
|
|
|
|
|
PaddyLong
|
Posted: Thu Jun 05, 2003 4:17 pm Post subject: (No subject) |
|
|
flexible arrays wouldn't really work... they just resize the array, not reset it... |
|
|
|
|
|
|