---
title: "Task of reinterpret cast operator"
subject: "Object Oriented Programming"
chapter: 7
key: "semester_3/object_oriented_programming:reinterpret-cast"
source: https://www.bctengineer.com/q/semester_3/object_oriented_programming/reinterpret-cast
site: BCT Engineering
---

# Task of reinterpret cast operator

Object Oriented Programming · Chapter 7: Polymorphism and Dynamic Binding

- Asked in: 2070 Chaitra, 2 marks
- Video: [reinterpret_cast In C++](https://www.youtube.com/watch?v=JBvEfB_F66o) — CppNuts
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_3/object_oriented_programming/reinterpret-cast
- Whole chapter: https://www.bctengineer.com/md/semester_3/object_oriented_programming/chapter-7

## Question

What is the task of reinterpret cast operator?

## Short answer

reinterpret_cast reinterprets the bit pattern of one type as another without conversion, used for conversions between unrelated pointer types or pointers to integers. It is unsafe, non-portable, and only for low-level operations like raw memory access.

## Answer

`reinterpret_cast` is a C++ cast operator that converts one type into a completely different type by **reinterpreting the bit pattern**, without any run-time check or value conversion. It is used for conversions between unrelated pointer types, and between pointers and integers.

Syntax: `reinterpret_cast<new_type>(expression)`

```cpp
#include <cstdint>

int x = 65;
int *ip = &x;
char *cp = reinterpret_cast<char*>(ip);            // view int memory as bytes
uintptr_t addr = reinterpret_cast<uintptr_t>(ip);  // pointer to integer
```

It is unsafe and non-portable. It cannot remove `const` (that needs `const_cast`), and it should be used only for low-level work such as hardware access or handling raw memory.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What does reinterpret_cast do?
   A. Checks types at run time
   B. Reinterprets the bit pattern as another type with no check
   C. Removes const
   D. Converts only related classes
   Answer: B. It reinterprets bits without any run-time check or value conversion. (Key point: What it does)

2. Which cast should be used to remove const?
   A. reinterpret_cast
   B. const_cast
   C. typeid
   D. dynamic_cast
   Answer: B. reinterpret_cast cannot remove const; const_cast is needed. (Key point: Removing const)

3. How is reinterpret_cast best described?
   A. Safe and portable
   B. Unsafe and non-portable, for low-level work
   C. Safe only for classes
   D. Checked at run time
   Answer: B. It is unsafe and non-portable, suited to raw memory or hardware access. (Key point: Safety)

## Related in other subjects

- [Gas chamber STP monitoring with 8255 and ADCs](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Agas-chamber-stp) — Instrumentation II, chapter 4
