What happens if delete is used in C++ on a non-null pointer that was not…

TPSC Computer/IT Posts 2026Modified — slightly modified from the official paper; see the solution

What happens if delete is used in C++ on a non-null pointer that was not allocated with new?

  1. A.

    Memory is freed safely

  2. B.

    Program runs normally

  3. C.

    Undefined behavior

  4. D.

    Pointer is reset to NULL

Attempted by 130 students.

Sign up free to check your answer

Sign up free

Explore the full course: Isro

Loading lesson…