Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Deleting elements in an array
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
tum_twish




PostPosted: 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
Sponsor
sponsor
Martin




PostPosted: 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




PostPosted: Thu Jun 05, 2003 10:53 am   Post subject: (No subject)

what r linked lists?
Martin




PostPosted: 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
code:
var first : ^list
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




PostPosted: Thu Jun 05, 2003 11:19 am   Post subject: (No subject)

i kinda thought he was talking about flexible arrays..
PaddyLong




PostPosted: 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...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: