← BYTES
C++·Starter·Ref: 8.1.13

What does the `new` operator do in C++?

Have a question about this video? Mention reference 8.1.13 when you contact us.

a.Declares a new variable with automatic (stack) storage
b.Creates a new class definition
c.Deletes an existing object
d.Allocates memory on the heap and constructs an object there, returning a pointer to it
`new T(args)` allocates sufficient heap memory for a T, runs T's constructor on it, and returns a pointer to the newly constructed object -- the C++ counterpart to C's malloc, but combined with construction.

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES8113#C