0

void TraverseList(const List *l , void (*Visit)(ListEntry)) { // }

I confused about the above function call within the argument of a function,how it is working?

3
  • 4
    I suggest you find some books to read, or at least some tutorials about function pointers. Commented Jun 11, 2018 at 5:50
  • It is not a function call but an argument of type void(*)(ListEntry) Commented Jun 11, 2018 at 5:56
  • You can always check cdecl.org - void (*Visit)(ListEntry) ==> declare Visit as pointer to function (ListEntry) returning void Commented Jun 11, 2018 at 6:12

1 Answer 1

2

Visit is a function pointer parameter passed to the TraverseList function. It should point to a function with the format

void func (ListEntry);

Likely, TraverseList will call the passed function for every item in the list.

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.