when to use void* in c++

前端 未结 2 463
予麋鹿
予麋鹿 2021-01-04 20:57

I am trying to wrap my head about a void* and what is appropriate use of it and if there is any potentially abusive use I should know about. (Meaning something

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-04 21:25

    void* is a memory address without a type. It's useful when the code around it has some other way of knowing what type it is working with (for example, memchr needs to have the size of the memory area passed in addition to the address).

提交回复
热议问题