+ 1
What is the meaning of void* ? What it works?
void pointer means and what it will give us ?
1 Resposta
+ 3
It is also know as generic pointer that can be pointed at objects of any data type. It maybe int, float, double. It has no return type that is initially pointer is created with pointer type (having hex value) and we can assign this pointer to any type of data.
Example
#include <iostream>
using namespace std;
int main() {
void* ptr;
float f = 2.3;
ptr = &f; // float* to void
cout << &f << endl; cout << ptr;
return 0;
}