Where exactly do function pointers point?

后端 未结 5 2023
栀梦
栀梦 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:22

    Function pointers point to the address of the function in memory.

    Based on the way function pointers are usually assigned, I would be surprised if you had them pointing to a data location. They are not typically cast and so unlikely to point anywhere other than to a valid function. If you are casting them a lot, then this could be a problem. More likely though is that the data you are passing to the function is wrong.

提交回复
热议问题