reinterpret_cast in C++ (Convert Types of pointers)

PHOTO EMBED

Tue Jun 28 2022 13:55:34 GMT+0000 (Coordinated Universal Time)

Saved by @Marcos_ #c++

data_type *var_name = 
       reinterpret_cast <data_type *>(pointer_variable);
content_copyCOPY

reinterpret_cast is a type of casting operator used in C++. It is used to convert a pointer of some data type into a pointer of another data type, even if the data types before and after conversion are different. It does not check if the pointer type and data pointed by the pointer is same or not.

https://www.geeksforgeeks.org/reinterpret_cast-in-c-type-casting-operators/