Dereference void pointer

前端 未结 7 1606
借酒劲吻你
借酒劲吻你 2020-12-08 10:47

Even after casting a void pointer, I am getting compilation error while dereferencing it. Could anyone please let me know the reason of this.

int lVNum = 2;
         


        
相关标签:
7条回答
  • 2020-12-08 11:23

    A void pointer is just that, a pointer to a void (nothing definable).

    Useful in some instances. For example malloc() returns a void pointer precisely because it allocated memory for an UNDEFINED purpose. Some functions may likewise take void pointers as arguments because they don't care about the actual content other than a location.

    To be honest, the snippet you posted makes absolutely no sense, can't even guess what you were trying to do.

    0 讨论(0)
提交回复
热议问题