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
Explain structured programming The principal idea behind structured programming was as easy as the idea of "divide and conquer." A computer program could be regarded as having

Ask question #Minimum 100 words acceptedEducational Objectives: After completing this assignment, the student should be able to accomplish the following: Apply generic algorithms i

Define the Data File in C Programming? Many applications needs that information can written to or read from an auxiliary memory device. Such information is stock up on the memo

C Program for FUNCTION OF FIND THE FACTORIAL float factorial(float); void main() {           float i=0,c=0;           clrscr();           printf("ENTER THE DIGI

Q-What happens while a function throws an exception which was not specified through an exception specification for this function? A: Unexpected() is called, which, by default, w

Is there any difficulty with the following : char*a=NULL; char& p = *a;? A: The result is indeterminate. You must never do this. A reference has to always refer to some object.

write a c++ program to find the prime numbers

Write a c++ program that contain the following functions : 1) Function Quality_Point that takes one int argument (student_average) and return ‘A’ if the student_average between 90-

my program does not run more than 9 iterations when ever i want to iterate more than 100 iterations. what is the reason and how to tackle?

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome