electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks GalleryGallery 
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
Can I set many elements at once in a multi dim array?
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [2 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Dr. Spankenstein



Joined: Mar 03, 2007
Posts: 136
Location: Cambridge
Audio files: 1

PostPosted: Wed Jan 30, 2008 5:35 am    Post subject: Can I set many elements at once in a multi dim array? Reply with quote  Mark this post and the followings unread

Code:


int a[][];

// Assign to a single determined element

[
   [0,1],
   [0,2],
   [0,3],
   [0,4]
] @=> a;
<<<a[1][1]>>>;

// How would I replace a specific element?

//[[5,8]] @=> a[1][];

// In other words:

[
   [0,1],
   [0,2],
   [0,3],
   [0,4]
] @=> a;

//Would now become:

[
   [0,1],
   [5,8],
   [0,3],
   [0,4]
] @=> a;

// Replacing only one line?



Thanks guys,

Rhys
Back to top
View user's profile Send private message
Kassen
Janitor
Janitor


Joined: Jul 06, 2004
Posts: 6249
Location: The Hague, NL
G2 patch files: 3

PostPosted: Wed Jan 30, 2008 9:59 am    Post subject: Re: Can I set many elements at once in a multi dim array? Reply with quote  Mark this post and the followings unread

Code:


[5,8] @=> a[1];


That's it. You can look at 2d arrays as "a array of arrays" so here we are asigning a new array to one of it's locations

_________________
while(!machine.crash() ) <<<"all is well">>>;
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [2 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
Buy N Save

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003, 2004, 2005, 2006 and 2007 by electro-music.com