How to pass 2D Array to method?

Hi. The whole pointer/reference thing is kinda weird for me so it might just be my lack of understanding for those, but

I can manage to pass a 1 dimensional Array into a method, but not a 2D Array…

What doin wrong here?

char nachricht[20] = "1234567890ABCDEFGHJ";
char output[3][3] = {{1,2,3},{1,2,3},{1,2,3}};


void setup()
{
  Serial.begin(9600);
  uebergabeStr( &output[0][0]); 
}

void loop()
{
}

void uebergabeStr(char *poutput)
{
  Serial.println(poutput[0][0]);
}

ERROR says “invalid type ‘char[int]’ for array subscript” which I understand as there is one [0] to much in the line that prints into the Serial. But I dont get that. I seem to be able to pass the array as a 2 dimensional one or better: to pass the reference to it, but i cant use it.

A 2D array is an array of arrays. You need to either tell the function the exact size of the array in each direction, or use the pointer to pointer notation:

void uebergabeStr(char poutput[3][3]) or void uebergabeStr(char **poutput)

void uebergabeStr(char **poutput)

That's not going to work; a pointer to a two dimension array of chars is NOT the same as a pointer to an array of strings (pointer to char style strings.)

void uebergabeStr(char poutput[3][3])

This is the best way to do it. This way everything knows exactly what it is.

  uebergabeStr( &output[0][0]); 
   :
void uebergabeStr(char *poutput) {
  Serial.println(poutput[0][0]);

This is simply inconsistent. The call (&out...) gives you a pointer to char, which the function gets properly, but you can't do double indicies off of a char* pointer...