This is not well-defined.
You're using %p
, which expects an argument of type void *
, but you're actually passing it a value of type int (*)()
, i.e. your (also badly defined) main()
function.
You cannot portably cast a function pointer to void *
, so your code can never be correct.
On most typicaly systems, sizeof (void *) == sizeof main
, so you simply get the value interpreted as a void *
which probably will simply be the address of the function.
Passing a function address to printf()
with a format specifier of %d
is even worse, since it's quite likely that sizeof (int) != sizeof main
and then you get undefined behavior.
This is not good code.