Looping through array of arrays only prints first element of sub-arrays

I'm trying to iterate through an array of arrays. The array looks like:

    arrayOuter = { {1}, {2,3}, {4,5,6}}

Unfortunately, looping through, my code only prints the first element of each sub-array. Can anyone explain why? And how to fix this?

    unsigned int* arrayOuter[3]; 
    unsigned int arrayA[1] = {1};
    unsigned int arrayB[2] = {2,3};
    unsigned int arrayC[3] = {4,5,6};
  
    void setup()
    {
        Serial.begin(9600);
        arrayOuter[0] = arrayA;
        arrayOuter[1] = arrayB;
        arrayOuter[2] = arrayC;
  
        for (int i = 0; i < (sizeof(arrayOuter)/sizeof(int)); i++) 
        {
 
                for (int j = 0; j < (sizeof(arrayOuter[i])/sizeof(int)); j++) 
                {
                        Serial.println(arrayOuter[i][j]);
                 }  
        }
    }

Please put your code in code tags. As it stands part of it is in italics.

420gandhi:

    unsigned int* arrayOuter[3]; 

for (int j = 0; j < (sizeof(arrayOuter[i])/sizeof(int)); j++)

arrayOuter[ i ] is a char*, which is the same size as int, therefore sizeof(arrayOuter[ i ])/sizeof(int) --> 1

At runtime, there is likely no easy way to get the original sizes of the inner arrays that you have used as initializes in the outer array. It would be preferable to use a sentinel value on the end of the inner array, or just have the inner array all be the same length.

edit: fixed code that turned into italics

Thanks!
So, my understanding is that if I was to use a sentinal value at the end of my sub-arrays, I should have a while loop to loop through them, and exit when the specific sentinal value is reached, right?

right?

Yes.

#define ARRAY_ENTRIES(ARRAY)        (sizeof(ARRAY) / sizeof(ARRAY[0]))

struct arrays_t
{
    const size_t         m_length;
    const unsigned int*  m_ptr;
};

unsigned int arrayA[] = { 1 };
unsigned int arrayB[] = { 2, 3 };
unsigned int arrayC[] = { 4, 5, 6 };

arrays_t    arrays[] =
{
      { ARRAY_ENTRIES(arrayA), arrayA }
    , { ARRAY_ENTRIES(arrayB), arrayB }
    , { ARRAY_ENTRIES(arrayC), arrayC }
};

void loop()
{   }

void setup()
{
    for ( size_t n = 0; n < ARRAY_ENTRIES(arrays); n++ )
    {
        for ( size_t i = 0; i < arrays[n].m_length; i++ )
        {
            Serial.println(arrays[n].m_ptr[i]);
        }
    }
}