Which operator is used in C++ to dynamically allocate memory for a single object?

Options

  • A. malloc
  • B. alloc
  • C. new
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. new

Detailed Explanation

Correct Answer: Option C — new

Explanation: The new operator dynamically allocates memory and initializes an object as appropriate. For example, int *p = new int(10); allocates an integer initialized to 10. Memory allocated with new should generally be released using delete.