Describe how can i allocate/unallocate an array of things?, C/C++ Programming

A: Use p = new T[n] and delete[] p:

 

Fred* p = new Fred[100];

...

delete[] p;

Any time you allocate an array of objects through new (generally with the [n] in the new expression), you have to use [] in the delete statement. This syntax is essential because there is no syntactic difference among a pointer to a thing and a pointer to an array of things (something we inherited from C).

 

Posted Date: 3/19/2013 8:42:24 AM | Location : United States







Related Discussions:- Describe how can i allocate/unallocate an array of things?, Assignment Help, Ask Question on Describe how can i allocate/unallocate an array of things?, Get Answer, Expert's Help, Describe how can i allocate/unallocate an array of things? Discussions

Write discussion on Describe how can i allocate/unallocate an array of things?
Your posts are moderated
Related Questions
How would I make a maze in C++? I would prefer to use the recursion maze generation algorithm if possible, thanks!

2. a) Define a structure to store roll no, name and marks of a student. b) Using the structure of Q2. a), above write a ''C'' program to create a file "student.dat". There must be

Different implementations of OOP Object-oriented programming is not mainly concerned with the details of the program operation. Instead, it deals with the overall design of the

Write an algorithm to print all even numbers in descending order and draw the flowchart.

Calculate the salary if the person work 8 hours/day and the salary/hour is RM5.20 - UML class diagaram -Class -Exception handling/assertion

HOW TO USE POINTER

c++ coding decode the letters from numbers


1) Database: The database needs to be used for persistent storage of cars. For details of what information should be stored in the database, please see the description above. You

Q. Explain that how do we implement two stacks in one array A[1..n] in such a way that neither the stack overflows unless the total number of elements in both stacks together is n.