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

Assignment Help:

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).

 


Related Discussions:- Describe how can i allocate/unallocate an array of things?

Stack, write a simple c++ program to implement a stack: 1. push 2. pop

write a simple c++ program to implement a stack: 1. push 2. pop

Luminous Jewels - The Polishing Game, Byteland county is very famous for lu...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Dds, dsgdgdgdfgegwfesfsddfvxvwe

dsgdgdgdfgegwfesfsddfvxvwe

Advanced, how to create a shopping cart

how to create a shopping cart

List any six commonly found programming errors, List any six commonly found...

List any six commonly found programming errors in a C program Six commonly found errors in a C program are: 1.  Missing or misplaced  ; or  }, missing return type for a proc

Boardcoloring, how to fill the blank space in4*4 matrix?

how to fill the blank space in4*4 matrix?

Variable, what is local and global variable?give me some example to underst...

what is local and global variable?give me some example to understand better

Explain virtual functions, Virtual Functions The keyword virtual was pr...

Virtual Functions The keyword virtual was previously used to resolve ambiguity for a class derived from two classes, both having a common ancestor. These classes are known as v

Program to sort a range of numbers with insertion, Program to sort a range ...

Program to sort a range of numbers with Insertion: /* define variable */ const int max=29000; int list[max]; FILE *fp; clock_t start,end; char any1[8];

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd