且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在C ++中,我收到一条消息“错误:'void *'不是指向对象的指针类型".

更新时间:2022-03-03 04:32:30

如编译器消息所述,void*不是指向对象类型的指针.这意味着您不能使用void*进行任何操作,除了将其显式转换回另一种指针类型. void*代表地址,但未指定其指向的内容的类型,因此您无法对其进行操作.

As the compiler message says, void* is not a pointer to object type. What this means is that you cannot do anything with void*, besides explicitly converting it back to another pointer type. A void* represents an address, but it doesn’t specify the type of things it points to, and at a consequence you cannot operate on it.