0
I’m having error signing an array:
Menu m = Menu();
m.Options[4] = {"teste1","teste2","teste3","teste4"};//Erro aqui
m.Show();
Menu Class:
class Menu
{
public:
    String Options[];
    int index = 0;
    int len = 0;
    String Show()
    {
        while(controller.Button == 0)
        {
        len = sizeof(Options)/sizeof(Options[0]);
            index = index + controller.Left;
            if (index < 0)
            index = len;
            if (index > len)
            index = 0;
            display.setCursor(0,00);
            Clear();
            display.println(Options[index]);
            DrawBuffer();
        }
        return Options[index];
    }
 };
I’ve already tried:
m.Options[] = {"teste1","teste2","teste3","teste4"}; and m.Options = {"teste1","teste2","teste3","teste4"};, 
Didn’t work either.
This is the mistake: no match for 'operator=' (operand types are 'String' and '<brace-enclosed initializer list>')
I’m a beginner in C.
How the class was defined
Menu?– Isac
@Isac I just included the Menu class in the question
– isaque
When an array is statically defined it must have the elements assigned at that time and/or the size. To be assigned later it has to be set static and instantiated with
mallocornewwhich will be more appropriate for your example since it is C++ and not C. And even the size will have to be saved as you will not be able to know it later. I answered a question just yesterday with a similar problem– Isac