reinterpret_cast in C++ (Convert Types of pointers)


Tue Jun 28 2022 13:55:34 GMT+0000 (UTC)

Saved by @Marcos_ #c++

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

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.