Read an array of function pointers inside out

A logging module declares the following table of formatter functions, each chosen by a message level:


C
char *(*table[3])(int);


Arrange the steps of the inside-out reading rule in the order you apply them to decode this declaration, from the first look at the code to the final description of what table is.

  1. 1.

    Look right to [3]: table is an array of three elements.

  2. 2.

    Leave the parentheses and look right to (int): each pointer points to a function taking an int.

  3. 3.

    Start at the identifier table.

  4. 4.

    Reach the closing parenthesis, then look left to *: each element is a pointer.

  5. 5.

    Look left to the remaining char *: each function returns a pointer to char.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Function Pointers Questions: