question  Question about "operator new"

Null (197)   Link to this post
Hello, just a quick question about new
With new[] it's clear. E.g.
char *c=new char[23]; // allocating space for 23 chars in memory
but how about
char *c=new char;
I didn't specify how much memory I need so how does this work?
firedraco (2618)   Link to this post
It creates a single character. It's the same as:

char* c = new char[1];
helios (6064)   Link to this post
Almost the same. new T[1] should be deleted with delete[], but new T should be deleted with delete.

This topic is archived - New replies not allowed.