开发者

Any difference between these two in c++?

new char[1] 开发者_高级运维and new char,essentially the same thing,hm?


You have to delete char[1] with delete[] according to the standard, so not quite identical.


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[])


No. char[1] is of type char*, while char is of type char.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜