Reputation: 5949
new char[1]
and new char
,essentially the same thing,hm?
Upvotes: 5
Views: 219
Reputation: 179779
The objects created are the same, the (invisible) bookkeeping used is not.
That means that you can use the chars in the same way, but you must delete them with the matching delete operator (delete
versus delete[]
)
Upvotes: 2
Reputation: 116654
You have to delete char[1]
with delete[]
according to the standard, so not quite identical.
Upvotes: 15