Below is an example of the same: In the above code s is an instance of struct point and ptr is the struct pointer because it is storing the address of struct point. In line 15, the address of my_dog is assigned to ptr_dog using & operator.. The advantage cast pointer to void* when use new - C++ - YouTube Originally Posted by Adak. Void Pointer in C - javatpoint casting void * to array It does not check if the pointer type and data pointed by the pointer is same or not. In fact, to go to a void pointer you don't even need the cast, it's implicit, as per my example: //&tp takes the address of the tp struct. With lint -Xalias_level=weak (or higher), this generates a warning. 3,211. Explain the concept of pointer to pointer and void pointer in C language? I also have a warning about a for loop running two conditions, but it's just a. struct foo { int a; int b; }; struct foo *f; void *vp; void main () { f = (struct foo *)vp; /* struct pointer cast of void pointer warning . A void pointer can hold address of any type and can be typecasted to any type. Everything seems normal, right? Collection of values placed under one name in a single block of memory Can put structs, arrays in other structs Given a struct instance, access the fields using the '. void* and casts, in C and C++ - Eli Bendersky's website It is a type of pointer that can hold the address of any datatype variable (or) can point to any datatype variable. Typecasting void pointer to a struct can be done in following. The reinterpret_cast<> I posted is the equivalent (valid) C++ code. The advantage cast pointer to void* when use new - C++ - YouTube Type Casting - C++ Tutorials - cplusplus.com