-
Because you're asking the compiler to do it.
You're going outside of the C standard when you convert from a pointer to an array to a function. Your compiler, apparently, does something "useful" here.
C is often called a portable assembler, and not without some merit. C does have a type system, but you can get around it pretty easily. A function pointer is supposed to point to a function, but as you can see, you can circumvent that. If the bytes at the location the function pointer points to look like a function, why wouldn't it act like a function call?
There's no guarantee that this will work--but on some systems, there's really no difference between a function and an array of bytes that happen to look like that function.
Popular pages
Recent additions