Rerefence to a const char* array
<p>I am trying to avoid to repeat my code for 5 differentes arrays. I have 3 arrays (could be more in future):</p>

<pre><code>const char *FirstlistOfOptionText[2]   = {OPT_1, 
                                         OPT_2};
const char *SecondlistOfOptionText[2]   = {OPT_1, 
                                         OPT_2};
const char *ThirdlistOfOptionText[2]  = {OPT_1, 
                                         OPT_2};    
</code></pre>

<p>THe elements in each one will not be the same. Now they are because I just copy&amp;paste them. Number of elements won't neither.</p>

<p>I have a function in which I want to print every element of a list depending on a value I give as parameter. Also, I need to print one of those elements in other color (all in white except one in green).</p>

<p>I just want to have one code for printing and selecting the color as I have right now. But I want to select the correct array before doing that. I thought about:</p>

<pre><code>const char *listOfOptions[];
if(menu_t.first_level_option == 0) {
    listOfOptions = FirstlistOfOptionText;
}
if(menu_t.first_level_option == 1) {
    listOfOptions = SecondlistOfOptionText;
}
if(menu_t.first_level_option == 2) {
    listOfOptions = ThirdlistOfOptionText;
}
</code></pre>

<p>But I get some errors about storage size of 'listOfOptions' isn't known. Or that I can't use const char** for a char* or thing like that. </p>

<p>What is the correct way to do this?</p>