Multiple choice technology programming languages

A const pointer cannot be assigned to an ordinary pointer.

  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

A const pointer (pointer to const data) cannot be implicitly assigned to an ordinary (non-const) pointer because this would allow modification of data that was declared as constant. This would violate the const-correctness principle of C++. You would need an explicit const_cast to perform this conversion, and even then, modifying the data through the resulting pointer is undefined behavior.