0

I have the following typedef:

typedef void (*Subs)(uint8_t button);

And for example this array:

 const Subs settings_sub[] = {Settings_SVA, BackToRoot};
 const uint8_t settings_size = 2;

Where "Settings_SVA, BackToRoot" are methods of the type:

void Method_name(uint8_t button){}

Now my problem is a different method, that uses these arrays and simply cycles through them:

void MoveThroughItems(uint8_t button, uint8_t counter, uint8_t limit, ??? subitems) {}

I don't know what to correctly place for the '???' for subitems, which is the above mentioned array.

Currently I use Subs subitems[] which results in an error:

invalid conversion from 'void (* const*)(uint8_t)' to 'void (**)(uint8_t)

And using "void (* const*)(uint8_t)" as the type results in:

error: expected ',' or '...' before 'subitems'
error: 'subitems' was not declared in this scope

I am pretty much stuck here, maybe I missed something simple?

1 Answer 1

3

You need const - const Subs subitems[] because you defined const Subs settings_sub[] = {Settings_SVA, BackToRoot};.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.