Pages: [1]   Go Down
Author Topic: modify 2D arrays  (Read 503 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried a lot of stuff, but I don't know how to assign new values to arrays inside arrays efficiently. I know how to assign single values to one point of the 2D array, but I am working on a code, where it would use up most of the memory just assigning values.

Anyone has some suggestions for me?

Code:
int array [3] [2];  //initialzie a 2D array

void setup(){
  array[1] = {1,2}; //assign an array to the second part of the "root" array.
}

void loop(){
}


I would also be happy if i could reassign the whole 2D array, like:
array = {{2,3},{1,2},{4,5}};
« Last Edit: February 04, 2013, 04:25:26 pm by Hasi321 » Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26477
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you considered using memcpy?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you considered using memcpy?

I am not sure what memcpy is...
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26477
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try here
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: