Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
337 views
in Information Technology by (95.2k points)
closed by
In C++, which of the following statements correctly returns the memory from the dynamic array pointer pp to the free store?  
1. delete pp [ ]; 
2. delete *pp; 
3. delete [ ]pp ;
4. delete pp;

1 Answer

0 votes
by (95.4k points)
selected by
 
Best answer
Correct Answer - Option 3 : delete [ ]pp ;

Concept:

Free store is the unused memory of the program and can be used to allocate the memory dynamically when program runs. Delete operator is used when there is no need of dynamically allocated memory.

Explanation:

Dynamic array pointer is created by using the new keyword which returns a pointer to the allocated block of memory.

Syntax for dynamic allocation for array :

char *pp = NULL;

pp = new char[10];

Now, to remove the memory from dynamic array pointer syntax is :

delete [ ]pp;    // it means delete array pointed to by pp

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...