Doubt in (void *)&ch

Helllo, what is actually explicit typecasting by using (void *) is doing here ?

Hey @yashsharma4304
A void pointer is a pointer that has no associated data type with it. A void pointer can hold address of any type and can be typcasted to any type.

   char x ='A';
   void *temp=&x;
   cout<< (void *)&x <<" "<<temp<<endl;

both will give same result
i.e saving address of x in temp pointer and then printing pointer

1 Like