New course! Every coder should learn Generative AI!
Try a free lesson+ 8
Void pointers are just like a normal pointer but it is used to store address of any data-type variable.
If you try to store int variable's address in float pointer it will return error. There comes void pointer useful when you're not sure about data-type.
Ex.
int a = 10;
float *b = &a;
Output
//Error
int a = 15;
void *b = &a;
Output
//Address of variable a