1

I have an array of function pointers

typedef uint32_t   (*test)     ( void );

static const test tests[] =
{
 test_1  ,
 test_2  ,
 test_3  ,
 test_4  ,
 test_5  ,
  
};

I want to return a pointer to the above function pointer array . Can anyone pls help me do it.

Thanks !

1 Answer 1

1

We should be able to write const test *get_tests(void);. Here we remember that the type of the array is convertible to the type of a pointer to the first element and do it the easy way.

Good use of typedef for the function pointer to make your life easier.

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.