Array of Arrays - non 2 dimentional

Is this doable?

char array1[] = {'abc123'};
char array2[] = {'def'};
char array3[] = {'ghi9'};

char array0[] = {'array1', 'array2', 'array3'};

void setup() {
    Serial.begin(9600);
    Serial.println("Serial Started");

    for(int i = 0; i < 3; i++) {
        Serial.println(array0[i]);
    }

}

void loop() {
  // put your main code here, to run repeatedly:

}

Most examples I find have the same number of elements in each array.
For my application the number of elements is not always the same.

Am I doing something wrong or am I trying the impossible?

FWIW I have a function that will extract info from one line from file into an array.
At the moment I use several files of one line each, so I have to run the function repeatedly.

For efficiency, I want to have one file with all the lines (below each other).
I will add a number (of lines) to the function and want to end up with an array of arrays.

char array1[] = {'abc123'};

Look again, more closely.

Google " Iliffe vector"

Is this doable?

No, for many reasons.

An array of arrays is possible, but you are not initializing ANY of the arrays properly.

You can have an array of pointers. It looks like this:

char *someStrings[] = {"abc", "de", "fghij"};

Interestingly, when you use it it looks just like a regular array. The difference is sizeof(*someStrings). With a 2-d array, each element is an array of n characters. With this, each element is a pointer to a character - four bytes (I think).[/code]

each element is a pointer to a character - four bytes (I think)

Pointers are two bytes. It's an address. The Arduino doesn't have enough memory of any kind (except the Due, where pointers are 4 bytes because ints are) to require more than an int to hold the address, and an int is 2 bytes.

PaulMurrayCbr:
You can have an array of pointers. It looks like this:

char *someStrings[] = {"abc", "de", "fghij"};

Interestingly, when you use it it looks just like a regular array. The difference is sizeof(*someStrings). With a 2-d array, each element is an array of n characters. With this, each element is a pointer to a character - four bytes (I think).[/code]

Thanks, this example really helped me solve my problem.

FWIW this works for me:

char array1[] = {"abc123"};
char array2[] = {"def"};
char array3[] = {"ghi9"};

char *array0[] = {array1, array2, array3};

void setup() {
    Serial.begin(9600);
    Serial.println("Serial Started");

    for(int i = 0; i < 3; i++) {
        Serial.println(array0[i]);
    }

}

void loop() {
  // put your main code here, to run repeatedly:

}

PaulS:
Pointers are two bytes. It's an address. The Arduino doesn't have enough memory of any kind (except the Due, where pointers are 4 bytes because ints are) to require more than an int to hold the address, and an int is 2 bytes.

Pointers to flash memory above 64k on a Mega for example need longer pointers, which must be held in longs.

aisc:
Thanks, this example really helped me solve my problem.
FWIW this works for me:

Yup.

In a 2-d array [nobbcode]someStrings[4][5][/nobbcode] , the memory looks like this (assuming we start at location 1000):

1000: On \0 \0 \0
1004: The \0 \0
1008: Mat \0 \0
1012: …

In the other method, it looks like this

1000: On \0 The \0 Mat \0
1011: 1000, 1003, 1007
1017: …

Where 0,3,7 are two-byte pointers into memory. In C syntax it looks the same when you use it, because C treats an array as if it were a pointer to the first element of that array. The difference is subtle but important. In the first method, the evaluated type of somestring is "pointer to an array of 5 char", wheras in the second method it's "pointer to an array of pointers to char".