Suppose func_ptr
is a function pointer to the function test()
.Then we know that can invoke the function test()
using this pointer as
(*func_ptr)();
But I was told today that even (***func_ptr)()
or (**********func_ptr)()
,ie with any number of * works.Why is it so?What is the reason.I was briefly told the reason in a comment but I just can't make sense of it.This is what I was told:
Well, when you dereference a function pointer, you get an expression of function type (technically a "function designator"). However, when used in most contexts, such a function expression will be implicitly converted back to a function pointer that points to itself. (This is similar to how in most contexts, an expression of array type will be implicitly converted to a pointer to its first element.) You can repeat this "loop" as many times as you want.
Can anyone explain in simple words in a more detailed manner?