If I have the following code example,
...
typedef void (*printer_t)(int);
int main()
{
printer_t p = &print_int;
p(5);
return 0;
}
Why does both p(5);
and (*p)(5);
output the desired behaviour of printing 5?
If I have a pointer to a function, is that not first required to be dereferenced and then be called, i.e. (*p)(5);
was the correct behaviour? How does p(5);
not result in an error by trying to use a calling operation on a memory address location?