This is just a quirk of C. There's no other reason but the C standard just says that dereferencing or taking the address of a function just evaluates to a pointer to that function, and dereferencing a function pointer just evaluates back to the function pointer.
This behavior is (thus obviously) very different from how the unary &
and *
operators works for normal variables.
So,
test2 = myprint;
test2 = &myprint;
test2 = *myprint;
test2 = **********myprint;
All just do exactly the same, gives you a function pointer to myprint
Similarly,
test2(s);
(*test2)(s);
(***********test2)(s);
Does the same, call the function pointer stored in test2
. Because C says it does.