Where exactly do function pointers point?

后端 未结 5 2021
栀梦
栀梦 2021-02-13 04:41

Given that all the primitive data types and objects have memory allocated, it is intuitively easy to imagine the pointers to these types.

But where exactly do function p

5条回答
  •  情话喂你
    2021-02-13 05:33

    Function pointer also point into memory, the only difference is that there is executable code at that memory location instead of data.

    On many platforms if you try to execute data (e.g. regular memory) you'll crash or cause an exception. This is known as Data Execution Prevention - a security measure to prevent applications inadvertently running dodgy code that may be placed there by malware.

提交回复
热议问题