Ace Your C++ Skills 2026 – Rock the ‘Thinking in C++’ Challenge!

Question: 1 / 565

What is one difference between dynamic memory allocation in C and C++?

C requires manual deallocation, unlike C++

C++ requires type casting from void*, unlike C

C allows direct constructor calls, unlike C++

C++ ensures destructors are called, unlike C

C++ ensures destructors are called when using dynamic memory allocation, while in C the programmer must manually handle this. One key difference is that C++ is an object-oriented language, so it handles memory allocation and deallocation automatically through the use of constructors and destructors. In contrast, C is a procedural language, meaning it does not have built-in support for objects and requires manual memory management. As a result, C++ ensures destructors are called to prevent memory leaks, while in C it is the programmer's responsibility to deallocate memory. Options A, B, and C are incorrect because they either describe features that are shared between C and C++, such as manual deallocation and direct constructor calls, or describe differences unrelated to dynamic memory allocation.

Get further explanation with Examzify DeepDiveBeta
Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy