[Solved] array of arrays / copy multiple arrays into another

Hi, i have searched but i couln't find a solution to my situation, could you please help ?

my values:

insigned int Values_1 [] = {5,8,11,14} insigned int Values_2 [] = {22,35,1} insigned int Values_3 [] = {1,2,3,4,5,6,7,8} insigned int values_4 [] = {33,25,46,89,12}

what i want :

All_Values [] = Values_1 & Values_2 & Values_3 & Values_4

i mean, multiple arrays should merge and become one big array like this: All_Values [] = {5,8,11,14,22,35,1,1,2,3,4,5,6,7,8,33,25,46,89,12}

how can i do it ?

thanks in advance

You could use for loops to copy it, or if you are adventurous you could try memcpy, or if you want a reference, you could try pointer manipulation. The biggest question is really WHY do you want to do it?

the reason is Values_1, Values_2 are changeable;

for example there are four alternatives to Values_2 as Values_2_1 , Values_2_2, Values_2_3, and Values_2_4

i want to select one of them and and to final array.

i have tried pointers but couln't use it. unsigned int* All_Values [] = {Values_1,Values_2,Values_3,Values_4};

i am trying to send this with ir - lib

My_Sender.IRsendRaw::send(All_Values, sizeof(All_Values)/sizeof(int), 38); //end the signal

If you are trying to store the codes for different IR commands, I would suggest storing them in Program Memory. See the article on PROGMEM http://www.arduino.cc/en/Reference/PROGMEM

Thank you TRex that was exactly what i were looking for :)

I searched it and looked into the definition, but i couln't get it. Could you please give me hint ?

Here’s some code with 2 PROGMEM arrays, and a function to copy one into a RAM buffer:

#include <avr/pgmspace.h>

// save some unsigned ints
PROGMEM  prog_uint16_t value1[]  = { 65000, 32796, 16843, 10, 11234};
PROGMEM  prog_uint16_t value2[]  = { 23450, 15826, 1233, 1450, 12314};
unsigned int ramBuffer[5];
void setup() {
  Serial.begin(9600);
}
void loop() 
{
  copyToRam(value1);
  for (byte i = 0; i < 5;i++) {
   Serial.println(ramBuffer[i]);
 }
 Serial.println();
  copyToRam(value2);
  for (byte i = 0; i < 5;i++) {
   Serial.println(ramBuffer[i]);
 }
 while(1); //infinite loop to "stop" execution
}

void copyToRam(prog_uint16_t source[]) {
  for (byte i = 0; i < 5;i++) {
    ramBuffer[i] = pgm_read_word_near(source + i);
  }  
}

TRex thank you very much, this code solved my problems :)

i had read the http://www.arduino.cc/en/Reference/PROGMEM before but i couldn't have understood it. Your code is much more easier to understand .