What does void* mean? what's the effect?

There are some functions in the library functions of the C language that can receive parameters of any type. If you check their function prototypes, you can find that their formal parameter types are pointers of type void*.

So why use void*?

In fact, it is very simple because these functions have one thing in common: they can receive parameters of any type. That's right because void* can receive pointers of any type in C language syntax .
But it also has disadvantages, because pointers of void type can only be compared in size, and cannot be operated and dereferenced. That is to say, if you want to access the content pointed to by the void pointer, you must cast it

Guess you like

Origin blog.csdn.net/2302_76339343/article/details/131662061