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

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




PostPosted: Tue Jan 15, 2008 4:45 pm   Post subject: arrays initialization

k i need to initialize all my array variables the same thing, so

var num: array 1..70 of boolean := init (false, false, false,.....)

sigh... how do i make this easier?
Sponsor
Sponsor
Sponsor
sponsor
StealthArcher




PostPosted: Tue Jan 15, 2008 5:01 pm   Post subject: Re: arrays initialization

For loops my friend, they are wondrous beings.
Oh and if you are making what I think you are having a constant would be good also.

code:

const numberofthings:int:=70
var chars:array 1..numberofthings of boolean
for v: 1..numberofthings
     chars(v):=false
end for


There, simple for loop initialization, make something similar for all other arrays that need it. Any other questions?
timtimpei




PostPosted: Tue Jan 15, 2008 5:05 pm   Post subject: RE:arrays initialization

thx a lot
StealthArcher




PostPosted: Tue Jan 15, 2008 5:06 pm   Post subject: RE:arrays initialization

No problem, always glad to help those willing to learn.
ericfourfour




PostPosted: Tue Jan 15, 2008 5:07 pm   Post subject: RE:arrays initialization

Or if you don't know the upper or lower bound of the array:

upper (chars)
lower (chars)
StealthArcher




PostPosted: Tue Jan 15, 2008 5:08 pm   Post subject: Re: arrays initialization

I assumed he did so I left it out, but anyhow, it's probably good for him to know.
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: