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

Username:   Password: 
 RegisterRegister   
 Flexible Array Help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mike200015




PostPosted: Fri Feb 25, 2005 10:12 pm   Post subject: Flexible Array Help

I have a flexible array of int, Can you set all of the vars with in the array to (0) at the begining, and when a new upper bound is added, that will be set to zero, but not reset all vars to zero Question
Sponsor
Sponsor
Sponsor
sponsor
AsianSensation




PostPosted: Fri Feb 25, 2005 10:36 pm   Post subject: (No subject)

just keep track of the size of your old array, I think by using upper?

code:
var num : flexible array 1 .. 5 of int
var oldSize : int

for rep : 1 .. upper (num)
    num (rep) := 0
end for

oldSize := upper (num)

new num, 25

for rep : oldSize .. upper (num)
    num (rep) := 0
end for
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  [ 2 Posts ]
Jump to:   


Style:  
Search: