Any difference between the two in C ++?

new char[1]and new charessentially the same, hm?

+5
source share
3 answers

You must remove char[1]using delete[]in accordance with the standard, therefore not completely identical.

+15
source

The created objects are the same, an (invisible) account is used.

This means that you can use the characters in the same way, but you must delete them using the corresponding delete operator ( deleteversus delete[])

+2
source

. char [1] char *, char char.

-1

All Articles