user66820: I have an Arduino sketch that passes an array into a method as a compound literal, but for some reason I keep getting the following error:

void setup() { }
void printConcatLine(char chunks[][20]) { }

void loop() {  
  printConcatLine((char[][20]){ "{", "255", "}" });
}

I've also tried passing the number of the pointers/length of the array, and explicitly terminating it:
void setup() { }
void printConcatLine(char *chunks[]) { }

void loop() {  
  printConcatLine((char*[]){ "{", "255", "}", NULL });
}

...and
void setup() { }
void printConcatLine(char chunks[][20]) { }

void loop() {  
  printConcatLine((char[][20]){ "{", "255", "}", "" });
}

But they both produce the same error.  
What is the correct method of passing the compound literal array as a method parameter?

user4143: You can't with the Arduino. I am not quite sure why, but I think it may be because it's a Modified Harvard architecture machine.
You can better achieve what you want with variadic arguments, however:
void printConcatLine(int num, ...) {
    va_list ap;
    const char *s;

    va_start(ap, num);
    for (int i = 0; i < num; i++) {
        s = va_arg(ap, const char *);
        Serial.print(s);
    }
    va_end(ap);
    Serial.println();
}

void setup() {
    Serial.begin(115200);
    printConcatLine(3, "{", "255", "}");
}

void loop() {

}

The first argument is the number of arguments that follow, and all the rest are string constants.

66820: <p>I have an Arduino sketch that passes an array into a method as a compound literal, but for some reason I keep getting the following error:
</p>

<pre class="lang-cpp prettyprint-override"><code>void setup() { }
void printConcatLine(char chunks[][20]) { }

void loop() {  
  printConcatLine((char[][20]){ "{", "255", "}" });
}
</code></pre>

<p>I've also tried passing the number of the pointers/length of the array, and explicitly terminating it:</p>

<pre class="lang-cpp prettyprint-override"><code>void setup() { }
void printConcatLine(char *chunks[]) { }

void loop() {  
  printConcatLine((char*[]){ "{", "255", "}", NULL });
}
</code></pre>

<p>...and</p>

<pre class="lang-cpp prettyprint-override"><code>void setup() { }
void printConcatLine(char chunks[][20]) { }

void loop() {  
  printConcatLine((char[][20]){ "{", "255", "}", "" });
}
</code></pre>

<p>But they both produce the same error.  </p>

<p>What is the correct method of passing the compound literal array as a method parameter?</p>
 4143: <p>You can't with the Arduino. I am not quite sure why, but I think it may be because it's a Modified Harvard architecture machine.</p>

<p>You can better achieve what you want with <em><a href="https://www.gnu.org/software/libc/manual/html_node/Variadic-Functions.html" rel="nofollow noreferrer">variadic</a> arguments</em>, however:</p>

<pre><code>void printConcatLine(int num, ...) {
    va_list ap;
    const char *s;

    va_start(ap, num);
    for (int i = 0; i &lt; num; i++) {
        s = va_arg(ap, const char *);
        Serial.print(s);
    }
    va_end(ap);
    Serial.println();
}

void setup() {
    Serial.begin(115200);
    printConcatLine(3, "{", "255", "}");
}

void loop() {

}
</code></pre>

<p>The first argument is the number of arguments that follow, and all the rest are string constants.</p>
