How do you get a pointer from an array and pass it to a function?

Hi,
I would like to have an array of char arrays and then send pointers to a function for processing. I’m completely confused by it though and don’t know whether I should be using 's or &'s etc.etc. If I try and compile this example piece of code I get a invalid conversion from 'const char’ to ‘char*’ error.
Any help greatly appreciated

const char *arrayofCharArrays[] = {"one", "two", "three", "four"};

void processArray (char* incomingpointer) {
  Serial.println(incomingpointer);
}

void setup() {
  Serial.begin(115200);
}

void loop() {
  for (byte iteration = 0; iteration < 4; iteration++){
    processArray(arrayofCharArrays[iteration]);
  }
}

OK forgot the const in the processArray argument !

This:

void processArray (char* incomingpointer) {

says the function is expecting a pointer to a char. But this:

processArray(arrayofCharArrays[iteration]);

is simply passing a char. You need either:

void processArray (char incomingpointer) {

or:

processArray(&arrayofCharArrays[iteration]);

Regards, Ray L.

Not quite, Ray. It is an array of char pointers, not chars. So arrayofCharArrays[0] should point to "one", not 'o'.

Thanks Ray and Keith,
if I put that missing const into the example piece of code, everything works as expected. Unfortunately this means the problem with my actual project is something else !

const char *arrayofCharArrays[] = {"one", "two", "three", "four"};

void processArray (const char* incomingpointer) {
  Serial.println(incomingpointer);
}

void setup() {
  Serial.begin(115200);
}

void loop() {
  for (byte iteration = 0; iteration < 4; iteration++){
    processArray(arrayofCharArrays[iteration]);
  }
}

KeithRB: Not quite, Ray. It is an array of char pointers, not chars. So arrayofCharArrays[0] should point to "one", not 'o'.

Sorry, yes, you're right. Read too fast...

Regards, Ray L.